Skip to content

Commit 76d76e0

Browse files
author
Stephen Belanger
authored
Update standard to remove eslint-plugin-node (#4146)
1 parent 8cc7705 commit 76d76e0

File tree

310 files changed

+1648
-1576
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

310 files changed

+1648
-1576
lines changed

.eslintignore

+2
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,5 @@ versions
77
acmeair-nodejs
88
vendor
99
integration-tests/esbuild/out.js
10+
integration-tests/esbuild/aws-sdk-out.js
11+
packages/dd-trace/src/appsec/blocked_templates.js

.eslintrc.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@
3434
"mocha/no-exports": 0,
3535
"mocha/no-skipped-tests": 0,
3636
"n/no-restricted-require": [2, ["diagnostics_channel"]],
37-
"object-curly-newline": ["error", {"multiline": true, "consistent": true }]
37+
"n/no-callback-literal": 0,
38+
"object-curly-newline": ["error", {"multiline": true, "consistent": true }],
39+
"import/no-absolute-path": 0
3840
}
3941
}

LICENSE-3rdparty.csv

-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ dev,eslint-config-standard,MIT,Copyright Feross Aboukhadijeh
4848
dev,eslint-plugin-import,MIT,Copyright 2015 Ben Mosher
4949
dev,eslint-plugin-mocha,MIT,Copyright 2014 Mathias Schreck
5050
dev,eslint-plugin-n,MIT,Copyright 2015 Toru Nagashima
51-
dev,eslint-plugin-node,MIT,Copyright 2015 Toru Nagashima
5251
dev,eslint-plugin-promise,ISC,jden and other contributors
5352
dev,eslint-plugin-standard,MIT,Copyright 2015 Jamund Ferguson
5453
dev,express,MIT,Copyright 2009-2014 TJ Holowaychuk 2013-2014 Roman Shtylman 2014-2015 Douglas Christopher Wilson

benchmark/dd-trace.js

+12-12
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ suite
2525
operation = () => {
2626
const span = tracer.startSpan('bench')
2727
span.addTags({
28-
'tag1': str + generateString(10),
29-
'tag2': str + str + generateString(10),
30-
'tag3': str + str + str + generateString(10)
28+
tag1: str + generateString(10),
29+
tag2: str + str + generateString(10),
30+
tag3: str + str + str + generateString(10)
3131
})
3232
span.finish()
3333
}
@@ -41,23 +41,23 @@ suite
4141
operation = () => {
4242
const rootSpan = tracer.startSpan('root')
4343
rootSpan.addTags({
44-
'tag1': generateString(20),
45-
'tag2': generateString(20),
46-
'tag3': generateString(20)
44+
tag1: generateString(20),
45+
tag2: generateString(20),
46+
tag3: generateString(20)
4747
})
4848

4949
const parentSpan = tracer.startSpan('parent', { childOf: rootSpan })
5050
parentSpan.addTags({
51-
'tag1': generateString(20),
52-
'tag2': generateString(20),
53-
'tag3': generateString(20)
51+
tag1: generateString(20),
52+
tag2: generateString(20),
53+
tag3: generateString(20)
5454
})
5555

5656
const childSpan = tracer.startSpan('child', { childOf: parentSpan })
5757
childSpan.addTags({
58-
'tag1': generateString(20),
59-
'tag2': generateString(20),
60-
'tag3': generateString(20)
58+
tag1: generateString(20),
59+
tag2: generateString(20),
60+
tag3: generateString(20)
6161
})
6262

6363
childSpan.finish()

benchmark/e2e-ci/benchmark-run.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ function getBranchUnderTest () {
2020
const getCommonHeaders = () => {
2121
return {
2222
'Content-Type': 'application/json',
23-
'authorization': `Bearer ${process.env.ROBOT_CI_GITHUB_PERSONAL_ACCESS_TOKEN}`,
24-
'Accept': 'application/vnd.github.v3+json',
23+
authorization: `Bearer ${process.env.ROBOT_CI_GITHUB_PERSONAL_ACCESS_TOKEN}`,
24+
Accept: 'application/vnd.github.v3+json',
2525
'user-agent': 'dd-trace benchmark tests'
2626
}
2727
}

benchmark/e2e/benchmark-run.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ function pad (str, num) {
158158
function logResult (results, type, testAsyncHooks) {
159159
console.log(`\n${type.toUpperCase()}:`)
160160
if (testAsyncHooks) {
161-
console.log(` without tracer with async_hooks with tracer`)
161+
console.log(' without tracer with async_hooks with tracer')
162162
for (const name in results.withoutTracer[type]) {
163163
console.log(
164164
pad(name, 7),
@@ -168,7 +168,7 @@ function logResult (results, type, testAsyncHooks) {
168168
)
169169
}
170170
} else {
171-
console.log(` without tracer with tracer`)
171+
console.log(' without tracer with tracer')
172172
for (const name in results.withoutTracer[type]) {
173173
console.log(
174174
pad(name, 7),

benchmark/e2e/express-helloworld-manyroutes/app.js

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
const crypto = require('crypto')
32
const app = require('express')()
43

benchmark/profiler/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ function benchmark (url, maxConnectionRequests) {
6060
}
6161

6262
function compare (result1, result2) {
63-
title(`Comparison (disabled VS enabled)`)
63+
title('Comparison (disabled VS enabled)')
6464

6565
compareNet(result1.net, result2.net)
6666
compareCpu(result1.cpu, result2.cpu)

benchmark/sirun/get-results.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@ const { execSync } = require('child_process')
77

88
const { CIRCLE_TOKEN, GITHUB_STATUS_TOKEN } = process.env
99

10-
const circleHeaders = CIRCLE_TOKEN ? {
11-
'circle-token': CIRCLE_TOKEN
12-
} : {}
10+
const circleHeaders = CIRCLE_TOKEN
11+
? { 'circle-token': CIRCLE_TOKEN }
12+
: {}
1313

14-
const githubHeaders = GITHUB_STATUS_TOKEN ? {
15-
Authorization: `token ${GITHUB_STATUS_TOKEN}`
16-
} : {}
14+
const githubHeaders = GITHUB_STATUS_TOKEN
15+
? { Authorization: `token ${GITHUB_STATUS_TOKEN}` }
16+
: {}
1717

1818
const statusUrl = (ref, page) =>
1919
`https://api.github.com/repos/DataDog/dd-trace-js/commits/${ref}/statuses?per_page=100&page=${page}`

benchmark/sirun/plugin-graphql/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ if (Number(process.env.WITH_ASYNC_HOOKS)) {
2323
require('async_hooks').createHook(hook).enable()
2424
}
2525

26-
const graphql = require(`../../../versions/graphql`).get()
26+
const graphql = require('../../../versions/graphql').get()
2727
const schema = require('./schema')
2828

2929
const source = `

benchmark/sirun/plugin-graphql/schema.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
'use strict'
22

3-
const graphql = require(`../../../versions/graphql`).get()
3+
const graphql = require('../../../versions/graphql').get()
44

55
const Human = new graphql.GraphQLObjectType({
66
name: 'Human',

benchmark/sirun/scope/index.js

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
const {
32
DD_TRACE_SCOPE,
43
COUNT

benchmark/sirun/squash-affinity.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,4 @@ function squashAffinity (obj) {
3232
}
3333
}
3434

35-
fs.writeFileSync(path.join(process.cwd(), `meta-temp.json`), JSON.stringify(metaJson, null, 2))
35+
fs.writeFileSync(path.join(process.cwd(), 'meta-temp.json'), JSON.stringify(metaJson, null, 2))

ci/init.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ if (isAgentlessEnabled) {
2020
exporter: 'datadog'
2121
}
2222
} else {
23-
console.error(`DD_CIVISIBILITY_AGENTLESS_ENABLED is set, \
24-
but neither DD_API_KEY nor DATADOG_API_KEY are set in your environment, \
25-
so dd-trace will not be initialized.`)
23+
console.error('DD_CIVISIBILITY_AGENTLESS_ENABLED is set, but neither ' +
24+
'DD_API_KEY nor DATADOG_API_KEY are set in your environment, so ' +
25+
'dd-trace will not be initialized.')
2626
shouldInit = false
2727
}
2828
} else {

integration-tests/ci-visibility.spec.js

+10-5
Original file line numberDiff line numberDiff line change
@@ -641,7 +641,8 @@ testFrameworks.forEach(({
641641
context(`early flake detection when reporting by ${reportingOption}`, () => {
642642
it('retries new tests', (done) => {
643643
const envVars = reportingOption === 'agentless'
644-
? getCiVisAgentlessConfig(receiver.port) : getCiVisEvpProxyConfig(receiver.port)
644+
? getCiVisAgentlessConfig(receiver.port)
645+
: getCiVisEvpProxyConfig(receiver.port)
645646
if (reportingOption === 'evp proxy') {
646647
receiver.setInfoResponse({ endpoints: ['/evp_proxy/v4'] })
647648
}
@@ -725,7 +726,8 @@ testFrameworks.forEach(({
725726
})
726727
it('handles parameterized tests as a single unit', (done) => {
727728
const envVars = reportingOption === 'agentless'
728-
? getCiVisAgentlessConfig(receiver.port) : getCiVisEvpProxyConfig(receiver.port)
729+
? getCiVisAgentlessConfig(receiver.port)
730+
: getCiVisEvpProxyConfig(receiver.port)
729731
if (reportingOption === 'evp proxy') {
730732
receiver.setInfoResponse({ endpoints: ['/evp_proxy/v4'] })
731733
}
@@ -810,7 +812,8 @@ testFrameworks.forEach(({
810812
})
811813
it('is disabled if DD_CIVISIBILITY_EARLY_FLAKE_DETECTION_ENABLED is false', (done) => {
812814
const envVars = reportingOption === 'agentless'
813-
? getCiVisAgentlessConfig(receiver.port) : getCiVisEvpProxyConfig(receiver.port)
815+
? getCiVisAgentlessConfig(receiver.port)
816+
: getCiVisEvpProxyConfig(receiver.port)
814817
if (reportingOption === 'evp proxy') {
815818
receiver.setInfoResponse({ endpoints: ['/evp_proxy/v4'] })
816819
}
@@ -874,7 +877,8 @@ testFrameworks.forEach(({
874877
})
875878
it('retries flaky tests', (done) => {
876879
const envVars = reportingOption === 'agentless'
877-
? getCiVisAgentlessConfig(receiver.port) : getCiVisEvpProxyConfig(receiver.port)
880+
? getCiVisAgentlessConfig(receiver.port)
881+
: getCiVisEvpProxyConfig(receiver.port)
878882
if (reportingOption === 'evp proxy') {
879883
receiver.setInfoResponse({ endpoints: ['/evp_proxy/v4'] })
880884
}
@@ -946,7 +950,8 @@ testFrameworks.forEach(({
946950
})
947951
it('does not retry new tests that are skipped', (done) => {
948952
const envVars = reportingOption === 'agentless'
949-
? getCiVisAgentlessConfig(receiver.port) : getCiVisEvpProxyConfig(receiver.port)
953+
? getCiVisAgentlessConfig(receiver.port)
954+
: getCiVisEvpProxyConfig(receiver.port)
950955
if (reportingOption === 'evp proxy') {
951956
receiver.setInfoResponse({ endpoints: ['/evp_proxy/v4'] })
952957
}

integration-tests/ci-visibility/features/support/steps.js

+3
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,15 @@ class Greeter {
44
sayFarewell () {
55
return 'farewell'
66
}
7+
78
sayGreetings () {
89
return 'greetings'
910
}
11+
1012
sayYo () {
1113
return 'yo'
1214
}
15+
1316
sayYeah () {
1417
return 'yeah whatever'
1518
}

integration-tests/ci-visibility/jest-custom-test-sequencer.js

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ class CustomSequencer extends Sequencer {
1212

1313
return [...tests].sort((a, b) => (a.path > b.path ? 1 : -1)).slice(shardStart, shardEnd)
1414
}
15+
1516
sort (tests) {
1617
const copyTests = [...tests]
1718
return copyTests.sort((testA, testB) => (testA.path > testB.path ? 1 : -1))

integration-tests/cucumber/cucumber.spec.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ const moduleType = [
4343
runTestsWithCoverageCommand:
4444
'./node_modules/nyc/bin/nyc.js -r=text-summary ' +
4545
'node ./node_modules/.bin/cucumber-js ci-visibility/features/*.feature',
46-
parallelModeCommand: `./node_modules/.bin/cucumber-js ` +
47-
`ci-visibility/features/farewell.feature --parallel 2 --publish-quiet`,
46+
parallelModeCommand: './node_modules/.bin/cucumber-js ' +
47+
'ci-visibility/features/farewell.feature --parallel 2 --publish-quiet',
4848
featuresPath: 'ci-visibility/features/',
4949
fileExtension: 'js'
5050
}

integration-tests/cypress/cypress.spec.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ moduleType.forEach(({
7575

7676
before(async () => {
7777
// cypress-fail-fast is required as an incompatible plugin
78-
sandbox = await createSandbox([`cypress@${version}`, `cypress-fail-fast@7.1.0`], true)
78+
sandbox = await createSandbox([`cypress@${version}`, 'cypress-fail-fast@7.1.0'], true)
7979
cwd = sandbox.folder
8080
webAppPort = await getPort()
8181
webAppServer.listen(webAppPort)
@@ -922,7 +922,7 @@ moduleType.forEach(({
922922
})
923923

924924
receiver.setKnownTests({
925-
'cypress': {
925+
cypress: {
926926
'cypress/e2e/spec.cy.js': [
927927
// 'context passes', // This test will be considered new
928928
'other context fails'
@@ -994,7 +994,7 @@ moduleType.forEach(({
994994
})
995995

996996
receiver.setKnownTests({
997-
'cypress': {
997+
cypress: {
998998
'cypress/e2e/spec.cy.js': [
999999
// 'context passes', // This test will be considered new
10001000
'other context fails'

integration-tests/esbuild/aws-sdk.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ require('../../').init() // dd-trace
22

33
const aws = require('aws-sdk')
44

5-
void aws.util.inherit
5+
global.test = aws.util.inherit

integration-tests/esbuild/build-and-test-aws-sdk.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ esbuild.build({
1414
plugins: [ddPlugin],
1515
platform: 'node',
1616
target: ['node18'],
17-
external: [ ]
17+
external: []
1818
}).then(() => {
1919
const { status, stdout, stderr } = spawnSync('node', [SCRIPT])
2020
if (stdout.length) {

integration-tests/graphql.spec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ describe('graphql', () => {
1515
let sandbox, cwd, agent, webFile, proc, appPort
1616

1717
before(async function () {
18-
sandbox = await createSandbox([`@apollo/server`, 'graphql', 'koalas'])
18+
sandbox = await createSandbox(['@apollo/server', 'graphql', 'koalas'])
1919
cwd = sandbox.folder
2020
webFile = path.join(cwd, 'graphql/index.js')
2121
appPort = await getPort()

integration-tests/pino.spec.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,12 @@ describe('pino test', () => {
4747
assert.containsAllKeys(stdoutData, ['dd'])
4848
assert.containsAllKeys(stdoutData.dd, ['trace_id', 'span_id'])
4949
assert.strictEqual(
50-
stdoutData['dd']['trace_id'],
51-
stdoutData['custom']['trace_id']
50+
stdoutData.dd.trace_id,
51+
stdoutData.custom.trace_id
5252
)
5353
assert.strictEqual(
54-
stdoutData['dd']['span_id'],
55-
stdoutData['custom']['span_id']
54+
stdoutData.dd.span_id,
55+
stdoutData.custom.span_id
5656
)
5757
})
5858

integration-tests/playwright/playwright.spec.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,8 @@ versions.forEach((version) => {
6262
context(`reporting via ${reportMethod}`, () => {
6363
it('can run and report tests', (done) => {
6464
const envVars = reportMethod === 'agentless'
65-
? getCiVisAgentlessConfig(receiver.port) : getCiVisEvpProxyConfig(receiver.port)
65+
? getCiVisAgentlessConfig(receiver.port)
66+
: getCiVisEvpProxyConfig(receiver.port)
6667
const reportUrl = reportMethod === 'agentless' ? '/api/v2/citestcycle' : '/evp_proxy/v2/api/v2/citestcycle'
6768

6869
receiver.gatherPayloadsMaxTimeout(({ url }) => url === reportUrl, payloads => {

integration-tests/profiler/profiler.spec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ describe('profiler', () => {
306306
})
307307
})
308308
})
309-
const [ port1, port2 ] = await p
309+
const [port1, port2] = await p
310310
const args = [String(port1), String(port2), msg]
311311
// Invoke the profiled program, passing it the ports of the servers and
312312
// the expected message.

node-upstream-tests/node/run_tests.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ const childProcess = require('child_process')
66
const path = require('path')
77
const fsUtils = require('./fs_utils')
88

9-
const NODE_BIN = process.env['NODE_BIN'] || '/usr/bin/node'
10-
const NODE_REPO_PATH = process.env['NODE_REPO_PATH']
9+
const NODE_BIN = process.env.NODE_BIN || '/usr/bin/node'
10+
const NODE_REPO_PATH = process.env.NODE_REPO_PATH
1111
if (NODE_REPO_PATH === undefined) {
1212
throw new Error('The env variable NODE_REPO_PATH is not set. This is required to locate the root of the nodejs repo')
1313
}
@@ -244,6 +244,7 @@ class TestResult {
244244
this.isPass = null
245245
this.isIgnore = null
246246
}
247+
247248
async init () {
248249
this.isPass = this.rc === 0
249250

@@ -257,6 +258,7 @@ class TestResult {
257258

258259
return this
259260
}
261+
260262
errorMessage () {
261263
let message = ''
262264
message += `Test output: rc ${this.rc}\n`

package.json

+1-2
Original file line numberDiff line numberDiff line change
@@ -116,11 +116,10 @@
116116
"dotenv": "16.3.1",
117117
"esbuild": "0.16.12",
118118
"eslint": "^8.23.0",
119-
"eslint-config-standard": "^11.0.0-beta.0",
119+
"eslint-config-standard": "^17.1.0",
120120
"eslint-plugin-import": "^2.8.0",
121121
"eslint-plugin-mocha": "^10.1.0",
122122
"eslint-plugin-n": "^15.7.0",
123-
"eslint-plugin-node": "^5.2.1",
124123
"eslint-plugin-promise": "^3.6.0",
125124
"eslint-plugin-standard": "^3.0.1",
126125
"express": "^4.18.2",

packages/datadog-core/test/utils/src/get.spec.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ const get = require('../../../src/utils/src/get')
77

88
describe('get', () => {
99
const obj = {
10-
'a': {
11-
'b': 'c'
10+
a: {
11+
b: 'c'
1212
}
1313
}
1414

0 commit comments

Comments
 (0)