Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🔥 Remove unused parameters #723

Merged
merged 1 commit into from
Feb 5, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ module.exports = {
'@typescript-eslint/no-parameter-properties': 'off',
'@typescript-eslint/no-unsafe-assignment': 'off',
'@typescript-eslint/no-unsafe-member-access': 'off',
'@typescript-eslint/no-unused-vars': 'error',
'@typescript-eslint/no-unused-vars': ['error', { args: 'all', argsIgnorePattern: '^_', vars: 'all' }],
'@typescript-eslint/no-use-before-define': 'off',
'@typescript-eslint/promise-function-async': 'off',
'@typescript-eslint/quotes': 'off',
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/tools/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ export function jsonStringify(

let result: string
try {
result = JSON.stringify(value, undefined, space)
result = JSON.stringify(value, replacer, space)
} catch {
result = '<error: unable to serialize object>'
} finally {
Expand Down
2 changes: 1 addition & 1 deletion packages/logs/src/boot/logs.entry.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ describe('logs entry', () => {
) => void
>
let startLogsGetGlobalContext: (() => Context) | undefined
const startLogs: StartLogs = (configuration, logger, getGlobalContext) => {
const startLogs: StartLogs = (_configuration, _logger, getGlobalContext) => {
startLogsGetGlobalContext = getGlobalContext
return (sendLogsSpy as any) as ReturnType<StartLogs>
}
Expand Down
2 changes: 1 addition & 1 deletion packages/logs/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const webpackBase = require('../../webpack.base')

const entry = path.resolve(__dirname, 'src/boot/logs.entry.ts')

module.exports = (env, argv) => [
module.exports = (_env, argv) => [
webpackBase({ mode: argv.mode, entry, datacenter: 'us', filename: 'datadog-logs.js' }),
webpackBase({ mode: argv.mode, entry, datacenter: 'us', filename: 'datadog-logs-us.js' }),
webpackBase({ mode: argv.mode, entry, datacenter: 'eu', filename: 'datadog-logs-eu.js' }),
Expand Down
4 changes: 2 additions & 2 deletions packages/rum-core/src/boot/rum.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ export function startRumEventCollection(
const batch = startRumBatch(configuration, lifeCycle)
startRumAssembly(applicationId, configuration, lifeCycle, session, parentContexts, getCommonContext)
startLongTaskCollection(lifeCycle)
startResourceCollection(lifeCycle, configuration, session)
const { addTiming } = startViewCollection(lifeCycle, configuration, location)
startResourceCollection(lifeCycle, session)
const { addTiming } = startViewCollection(lifeCycle, location)
const { addError } = startErrorCollection(lifeCycle, configuration)
const { addAction } = startActionCollection(lifeCycle, configuration)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ describe('error collection', () => {
.withConfiguration({
isEnabled: () => true,
})
.beforeBuild(({ lifeCycle, configuration }) => {
;({ addError } = doStartErrorCollection(lifeCycle, configuration, errorObservable))
.beforeBuild(({ lifeCycle }) => {
;({ addError } = doStartErrorCollection(lifeCycle, errorObservable))
})
})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,10 @@ export interface ProvidedError {
export type ProvidedSource = 'custom' | 'network' | 'source'

export function startErrorCollection(lifeCycle: LifeCycle, configuration: Configuration) {
return doStartErrorCollection(lifeCycle, configuration, startAutomaticErrorCollection(configuration))
return doStartErrorCollection(lifeCycle, startAutomaticErrorCollection(configuration))
}

export function doStartErrorCollection(
lifeCycle: LifeCycle,
configuration: Configuration,
observable: Observable<RawError>
) {
export function doStartErrorCollection(lifeCycle: LifeCycle, observable: Observable<RawError>) {
observable.subscribe((error) => lifeCycle.notify(LifeCycleEventType.RAW_RUM_EVENT_COLLECTED, processError(error)))

return {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ describe('resourceCollection', () => {
.withConfiguration({
isEnabled: () => true,
})
.beforeBuild(({ lifeCycle, configuration, session }) => {
startResourceCollection(lifeCycle, configuration, session)
.beforeBuild(({ lifeCycle, session }) => {
startResourceCollection(lifeCycle, session)
})
})

Expand Down Expand Up @@ -94,8 +94,8 @@ describe('resourceCollection', () => {
.withConfiguration({
isEnabled: () => true,
})
.beforeBuild(({ lifeCycle, configuration, session }) => {
startResourceCollection(lifeCycle, configuration, session)
.beforeBuild(({ lifeCycle, session }) => {
startResourceCollection(lifeCycle, session)
})
})

Expand Down Expand Up @@ -131,8 +131,8 @@ describe('resourceCollection', () => {
.withConfiguration({
isEnabled: () => true,
})
.beforeBuild(({ lifeCycle, configuration, session }) => {
startResourceCollection(lifeCycle, configuration, session)
.beforeBuild(({ lifeCycle, session }) => {
startResourceCollection(lifeCycle, session)
})
})

Expand Down Expand Up @@ -177,8 +177,8 @@ describe('resourceCollection', () => {
.withConfiguration({
isEnabled: () => true,
})
.beforeBuild(({ lifeCycle, configuration, session }) => {
startResourceCollection(lifeCycle, configuration, session)
.beforeBuild(({ lifeCycle, session }) => {
startResourceCollection(lifeCycle, session)
})
})

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,4 @@
import {
combine,
Configuration,
generateUUID,
getTimestamp,
msToNs,
RequestType,
ResourceType,
} from '@datadog/browser-core'
import { combine, generateUUID, getTimestamp, msToNs, RequestType, ResourceType } from '@datadog/browser-core'
import { RumPerformanceResourceTiming } from '../../../browser/performanceCollection'
import { RawRumResourceEvent, RumEventType } from '../../../rawRumEvent.types'
import { LifeCycle, LifeCycleEventType } from '../../lifeCycle'
Expand All @@ -21,7 +13,7 @@ import {
isRequestKind,
} from './resourceUtils'

export function startResourceCollection(lifeCycle: LifeCycle, configuration: Configuration, session: RumSession) {
export function startResourceCollection(lifeCycle: LifeCycle, session: RumSession) {
lifeCycle.subscribe(LifeCycleEventType.REQUEST_COMPLETED, (request: RequestCompleteEvent) => {
if (session.isTrackedWithResource()) {
lifeCycle.notify(LifeCycleEventType.RAW_RUM_EVENT_COLLECTED, processRequest(request))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ describe('viewCollection', () => {
.withConfiguration({
isEnabled: () => true,
})
.beforeBuild(({ lifeCycle, configuration }) => {
startViewCollection(lifeCycle, configuration, location)
.beforeBuild(({ lifeCycle }) => {
startViewCollection(lifeCycle, location)
})
})

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { Configuration, getTimestamp, isEmptyObject, mapValues, msToNs } from '@datadog/browser-core'
import { getTimestamp, isEmptyObject, mapValues, msToNs } from '@datadog/browser-core'
import { RawRumViewEvent, RumEventType } from '../../../rawRumEvent.types'
import { LifeCycle, LifeCycleEventType } from '../../lifeCycle'
import { trackViews, View } from './trackViews'

export function startViewCollection(lifeCycle: LifeCycle, configuration: Configuration, location: Location) {
export function startViewCollection(lifeCycle: LifeCycle, location: Location) {
lifeCycle.subscribe(LifeCycleEventType.VIEW_UPDATED, (view) =>
lifeCycle.notify(LifeCycleEventType.RAW_RUM_EVENT_COLLECTED, processViewUpdate(view))
)
Expand Down
2 changes: 1 addition & 1 deletion packages/rum-recorder/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const path = require('path')

const webpackBase = require('../../webpack.base')

module.exports = (env, argv) =>
module.exports = (_env, argv) =>
webpackBase({
mode: argv.mode,
entry: path.resolve(__dirname, 'src/boot/recorder.entry.ts'),
Expand Down
2 changes: 1 addition & 1 deletion packages/rum/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const webpackBase = require('../../webpack.base')

const entry = path.resolve(__dirname, 'src/boot/rum.entry.ts')

module.exports = (env, argv) => [
module.exports = (_env, argv) => [
webpackBase({ mode: argv.mode, entry, datacenter: 'us', filename: 'datadog-rum.js' }),
webpackBase({ mode: argv.mode, entry, datacenter: 'us', filename: 'datadog-rum-us.js' }),
webpackBase({ mode: argv.mode, entry, datacenter: 'eu', filename: 'datadog-rum-eu.js' }),
Expand Down
2 changes: 1 addition & 1 deletion rum-events-format
2 changes: 1 addition & 1 deletion scripts/generate-changelog.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ async function getChangesList() {

const changesWithPullRequestLinks = changesWithEmojis.replace(
/\(#(\d+)\)/gm,
(match, id) => `([#${id}](https://github.com/DataDog/browser-sdk/pull/${id}))`
(_, id) => `([#${id}](https://github.com/DataDog/browser-sdk/pull/${id}))`
)

return changesWithPullRequestLinks
Expand Down
2 changes: 1 addition & 1 deletion test/app/webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const path = require('path')

module.exports = (env, argv) => ({
module.exports = (_env, argv) => ({
entry: './app.ts',
module: {
rules: [
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/lib/framework/httpServers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ async function instantiateServerOnPort(port: number): Promise<http.Server> {
function createServerIdleWaiter(server: http.Server) {
const idleWaiter = createIdleWaiter()

server.on('request', (req: http.IncomingMessage, res: http.ServerResponse) => {
server.on('request', (_, res: http.ServerResponse) => {
idleWaiter.pushActivity(new Promise((resolve) => res.on('close', resolve)))
})

Expand Down
20 changes: 10 additions & 10 deletions test/e2e/lib/framework/serverApps/mock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,23 @@ export function createMockServerApp(endpoints: Endpoints, setup: string) {
app.use(cors())
app.disable('etag') // disable automatic resource caching

app.get('/empty', (req, res) => {
app.get('/empty', (_req, res) => {
res.end()
})

app.get('/favicon.ico', (req, res) => {
app.get('/favicon.ico', (_req, res) => {
res.end()
})

app.get('/throw', (req, res) => {
app.get('/throw', (_req, res) => {
res.status(500).send('Server error')
})

app.get('/unknown', (req, res) => {
app.get('/unknown', (_req, res) => {
res.status(404).send('Not found')
})

app.get('/empty.css', (req, res) => {
app.get('/empty.css', (_req, res) => {
res.header('content-type', 'text/css').end()
})

Expand All @@ -46,24 +46,24 @@ export function createMockServerApp(endpoints: Endpoints, setup: string) {
res.send(JSON.stringify(req.headers))
})

app.get('/', (req, res) => {
app.get('/', (_req, res) => {
res.send(setup)
res.end()
})

app.get('/datadog-logs.js', async (req, res) => {
app.get('/datadog-logs.js', async (_req, res) => {
res.header('content-type', 'application/javascript').send(await buildLogs(endpoints))
})

app.get('/datadog-rum.js', async (req, res) => {
app.get('/datadog-rum.js', async (_req, res) => {
res.header('content-type', 'application/javascript').send(await buildRum(endpoints))
})

app.get('/datadog-rum-recorder.js', async (req, res) => {
app.get('/datadog-rum-recorder.js', async (_req, res) => {
res.header('content-type', 'application/javascript').send(await buildRumRecorder(endpoints))
})

app.get('/app.js', async (req, res) => {
app.get('/app.js', async (_req, res) => {
res.header('content-type', 'application/javascript').send(await buildNpm(endpoints))
})

Expand Down