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

Update standard to remove eslint-plugin-node #4146

Merged
merged 1 commit into from
Mar 21, 2024
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@ versions
acmeair-nodejs
vendor
integration-tests/esbuild/out.js
integration-tests/esbuild/aws-sdk-out.js
packages/dd-trace/src/appsec/blocked_templates.js
4 changes: 3 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@
"mocha/no-exports": 0,
"mocha/no-skipped-tests": 0,
"n/no-restricted-require": [2, ["diagnostics_channel"]],
"object-curly-newline": ["error", {"multiline": true, "consistent": true }]
"n/no-callback-literal": 0,
"object-curly-newline": ["error", {"multiline": true, "consistent": true }],
"import/no-absolute-path": 0
}
}
1 change: 0 additions & 1 deletion LICENSE-3rdparty.csv
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ dev,eslint-config-standard,MIT,Copyright Feross Aboukhadijeh
dev,eslint-plugin-import,MIT,Copyright 2015 Ben Mosher
dev,eslint-plugin-mocha,MIT,Copyright 2014 Mathias Schreck
dev,eslint-plugin-n,MIT,Copyright 2015 Toru Nagashima
dev,eslint-plugin-node,MIT,Copyright 2015 Toru Nagashima
dev,eslint-plugin-promise,ISC,jden and other contributors
dev,eslint-plugin-standard,MIT,Copyright 2015 Jamund Ferguson
dev,express,MIT,Copyright 2009-2014 TJ Holowaychuk 2013-2014 Roman Shtylman 2014-2015 Douglas Christopher Wilson
Expand Down
24 changes: 12 additions & 12 deletions benchmark/dd-trace.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ suite
operation = () => {
const span = tracer.startSpan('bench')
span.addTags({
'tag1': str + generateString(10),
'tag2': str + str + generateString(10),
'tag3': str + str + str + generateString(10)
tag1: str + generateString(10),
tag2: str + str + generateString(10),
tag3: str + str + str + generateString(10)
})
span.finish()
}
Expand All @@ -41,23 +41,23 @@ suite
operation = () => {
const rootSpan = tracer.startSpan('root')
rootSpan.addTags({
'tag1': generateString(20),
'tag2': generateString(20),
'tag3': generateString(20)
tag1: generateString(20),
tag2: generateString(20),
tag3: generateString(20)
})

const parentSpan = tracer.startSpan('parent', { childOf: rootSpan })
parentSpan.addTags({
'tag1': generateString(20),
'tag2': generateString(20),
'tag3': generateString(20)
tag1: generateString(20),
tag2: generateString(20),
tag3: generateString(20)
})

const childSpan = tracer.startSpan('child', { childOf: parentSpan })
childSpan.addTags({
'tag1': generateString(20),
'tag2': generateString(20),
'tag3': generateString(20)
tag1: generateString(20),
tag2: generateString(20),
tag3: generateString(20)
})

childSpan.finish()
Expand Down
4 changes: 2 additions & 2 deletions benchmark/e2e-ci/benchmark-run.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ function getBranchUnderTest () {
const getCommonHeaders = () => {
return {
'Content-Type': 'application/json',
'authorization': `Bearer ${process.env.ROBOT_CI_GITHUB_PERSONAL_ACCESS_TOKEN}`,
'Accept': 'application/vnd.github.v3+json',
authorization: `Bearer ${process.env.ROBOT_CI_GITHUB_PERSONAL_ACCESS_TOKEN}`,
Accept: 'application/vnd.github.v3+json',
'user-agent': 'dd-trace benchmark tests'
}
}
Expand Down
4 changes: 2 additions & 2 deletions benchmark/e2e/benchmark-run.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ function pad (str, num) {
function logResult (results, type, testAsyncHooks) {
console.log(`\n${type.toUpperCase()}:`)
if (testAsyncHooks) {
console.log(` without tracer with async_hooks with tracer`)
console.log(' without tracer with async_hooks with tracer')
for (const name in results.withoutTracer[type]) {
console.log(
pad(name, 7),
Expand All @@ -168,7 +168,7 @@ function logResult (results, type, testAsyncHooks) {
)
}
} else {
console.log(` without tracer with tracer`)
console.log(' without tracer with tracer')
for (const name in results.withoutTracer[type]) {
console.log(
pad(name, 7),
Expand Down
1 change: 0 additions & 1 deletion benchmark/e2e/express-helloworld-manyroutes/app.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

const crypto = require('crypto')
const app = require('express')()

Expand Down
2 changes: 1 addition & 1 deletion benchmark/profiler/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ function benchmark (url, maxConnectionRequests) {
}

function compare (result1, result2) {
title(`Comparison (disabled VS enabled)`)
title('Comparison (disabled VS enabled)')

compareNet(result1.net, result2.net)
compareCpu(result1.cpu, result2.cpu)
Expand Down
12 changes: 6 additions & 6 deletions benchmark/sirun/get-results.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ const { execSync } = require('child_process')

const { CIRCLE_TOKEN, GITHUB_STATUS_TOKEN } = process.env

const circleHeaders = CIRCLE_TOKEN ? {
'circle-token': CIRCLE_TOKEN
} : {}
const circleHeaders = CIRCLE_TOKEN
? { 'circle-token': CIRCLE_TOKEN }
: {}

const githubHeaders = GITHUB_STATUS_TOKEN ? {
Authorization: `token ${GITHUB_STATUS_TOKEN}`
} : {}
const githubHeaders = GITHUB_STATUS_TOKEN
? { Authorization: `token ${GITHUB_STATUS_TOKEN}` }
: {}

const statusUrl = (ref, page) =>
`https://api.github.com/repos/DataDog/dd-trace-js/commits/${ref}/statuses?per_page=100&page=${page}`
Expand Down
2 changes: 1 addition & 1 deletion benchmark/sirun/plugin-graphql/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ if (Number(process.env.WITH_ASYNC_HOOKS)) {
require('async_hooks').createHook(hook).enable()
}

const graphql = require(`../../../versions/graphql`).get()
const graphql = require('../../../versions/graphql').get()
const schema = require('./schema')

const source = `
Expand Down
2 changes: 1 addition & 1 deletion benchmark/sirun/plugin-graphql/schema.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict'

const graphql = require(`../../../versions/graphql`).get()
const graphql = require('../../../versions/graphql').get()

const Human = new graphql.GraphQLObjectType({
name: 'Human',
Expand Down
1 change: 0 additions & 1 deletion benchmark/sirun/scope/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

const {
DD_TRACE_SCOPE,
COUNT
Expand Down
2 changes: 1 addition & 1 deletion benchmark/sirun/squash-affinity.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@ function squashAffinity (obj) {
}
}

fs.writeFileSync(path.join(process.cwd(), `meta-temp.json`), JSON.stringify(metaJson, null, 2))
fs.writeFileSync(path.join(process.cwd(), 'meta-temp.json'), JSON.stringify(metaJson, null, 2))
6 changes: 3 additions & 3 deletions ci/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ if (isAgentlessEnabled) {
exporter: 'datadog'
}
} else {
console.error(`DD_CIVISIBILITY_AGENTLESS_ENABLED is set, \
but neither DD_API_KEY nor DATADOG_API_KEY are set in your environment, \
so dd-trace will not be initialized.`)
console.error('DD_CIVISIBILITY_AGENTLESS_ENABLED is set, but neither ' +
'DD_API_KEY nor DATADOG_API_KEY are set in your environment, so ' +
'dd-trace will not be initialized.')
shouldInit = false
}
} else {
Expand Down
15 changes: 10 additions & 5 deletions integration-tests/ci-visibility.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -641,7 +641,8 @@ testFrameworks.forEach(({
context(`early flake detection when reporting by ${reportingOption}`, () => {
it('retries new tests', (done) => {
const envVars = reportingOption === 'agentless'
? getCiVisAgentlessConfig(receiver.port) : getCiVisEvpProxyConfig(receiver.port)
? getCiVisAgentlessConfig(receiver.port)
: getCiVisEvpProxyConfig(receiver.port)
if (reportingOption === 'evp proxy') {
receiver.setInfoResponse({ endpoints: ['/evp_proxy/v4'] })
}
Expand Down Expand Up @@ -725,7 +726,8 @@ testFrameworks.forEach(({
})
it('handles parameterized tests as a single unit', (done) => {
const envVars = reportingOption === 'agentless'
? getCiVisAgentlessConfig(receiver.port) : getCiVisEvpProxyConfig(receiver.port)
? getCiVisAgentlessConfig(receiver.port)
: getCiVisEvpProxyConfig(receiver.port)
if (reportingOption === 'evp proxy') {
receiver.setInfoResponse({ endpoints: ['/evp_proxy/v4'] })
}
Expand Down Expand Up @@ -810,7 +812,8 @@ testFrameworks.forEach(({
})
it('is disabled if DD_CIVISIBILITY_EARLY_FLAKE_DETECTION_ENABLED is false', (done) => {
const envVars = reportingOption === 'agentless'
? getCiVisAgentlessConfig(receiver.port) : getCiVisEvpProxyConfig(receiver.port)
? getCiVisAgentlessConfig(receiver.port)
: getCiVisEvpProxyConfig(receiver.port)
if (reportingOption === 'evp proxy') {
receiver.setInfoResponse({ endpoints: ['/evp_proxy/v4'] })
}
Expand Down Expand Up @@ -874,7 +877,8 @@ testFrameworks.forEach(({
})
it('retries flaky tests', (done) => {
const envVars = reportingOption === 'agentless'
? getCiVisAgentlessConfig(receiver.port) : getCiVisEvpProxyConfig(receiver.port)
? getCiVisAgentlessConfig(receiver.port)
: getCiVisEvpProxyConfig(receiver.port)
if (reportingOption === 'evp proxy') {
receiver.setInfoResponse({ endpoints: ['/evp_proxy/v4'] })
}
Expand Down Expand Up @@ -946,7 +950,8 @@ testFrameworks.forEach(({
})
it('does not retry new tests that are skipped', (done) => {
const envVars = reportingOption === 'agentless'
? getCiVisAgentlessConfig(receiver.port) : getCiVisEvpProxyConfig(receiver.port)
? getCiVisAgentlessConfig(receiver.port)
: getCiVisEvpProxyConfig(receiver.port)
if (reportingOption === 'evp proxy') {
receiver.setInfoResponse({ endpoints: ['/evp_proxy/v4'] })
}
Expand Down
3 changes: 3 additions & 0 deletions integration-tests/ci-visibility/features/support/steps.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,15 @@ class Greeter {
sayFarewell () {
return 'farewell'
}

sayGreetings () {
return 'greetings'
}

sayYo () {
return 'yo'
}

sayYeah () {
return 'yeah whatever'
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ class CustomSequencer extends Sequencer {

return [...tests].sort((a, b) => (a.path > b.path ? 1 : -1)).slice(shardStart, shardEnd)
}

sort (tests) {
const copyTests = [...tests]
return copyTests.sort((testA, testB) => (testA.path > testB.path ? 1 : -1))
Expand Down
4 changes: 2 additions & 2 deletions integration-tests/cucumber/cucumber.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ const moduleType = [
runTestsWithCoverageCommand:
'./node_modules/nyc/bin/nyc.js -r=text-summary ' +
'node ./node_modules/.bin/cucumber-js ci-visibility/features/*.feature',
parallelModeCommand: `./node_modules/.bin/cucumber-js ` +
`ci-visibility/features/farewell.feature --parallel 2 --publish-quiet`,
parallelModeCommand: './node_modules/.bin/cucumber-js ' +
'ci-visibility/features/farewell.feature --parallel 2 --publish-quiet',
featuresPath: 'ci-visibility/features/',
fileExtension: 'js'
}
Expand Down
6 changes: 3 additions & 3 deletions integration-tests/cypress/cypress.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ moduleType.forEach(({

before(async () => {
// cypress-fail-fast is required as an incompatible plugin
sandbox = await createSandbox([`cypress@${version}`, `[email protected]`], true)
sandbox = await createSandbox([`cypress@${version}`, '[email protected]'], true)
cwd = sandbox.folder
webAppPort = await getPort()
webAppServer.listen(webAppPort)
Expand Down Expand Up @@ -922,7 +922,7 @@ moduleType.forEach(({
})

receiver.setKnownTests({
'cypress': {
cypress: {
'cypress/e2e/spec.cy.js': [
// 'context passes', // This test will be considered new
'other context fails'
Expand Down Expand Up @@ -994,7 +994,7 @@ moduleType.forEach(({
})

receiver.setKnownTests({
'cypress': {
cypress: {
'cypress/e2e/spec.cy.js': [
// 'context passes', // This test will be considered new
'other context fails'
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/esbuild/aws-sdk.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ require('../../').init() // dd-trace

const aws = require('aws-sdk')

void aws.util.inherit
global.test = aws.util.inherit
Qard marked this conversation as resolved.
Show resolved Hide resolved
2 changes: 1 addition & 1 deletion integration-tests/esbuild/build-and-test-aws-sdk.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ esbuild.build({
plugins: [ddPlugin],
platform: 'node',
target: ['node18'],
external: [ ]
external: []
}).then(() => {
const { status, stdout, stderr } = spawnSync('node', [SCRIPT])
if (stdout.length) {
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/graphql.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ describe('graphql', () => {
let sandbox, cwd, agent, webFile, proc, appPort

before(async function () {
sandbox = await createSandbox([`@apollo/server`, 'graphql', 'koalas'])
sandbox = await createSandbox(['@apollo/server', 'graphql', 'koalas'])
cwd = sandbox.folder
webFile = path.join(cwd, 'graphql/index.js')
appPort = await getPort()
Expand Down
8 changes: 4 additions & 4 deletions integration-tests/pino.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,12 @@ describe('pino test', () => {
assert.containsAllKeys(stdoutData, ['dd'])
assert.containsAllKeys(stdoutData.dd, ['trace_id', 'span_id'])
assert.strictEqual(
stdoutData['dd']['trace_id'],
stdoutData['custom']['trace_id']
stdoutData.dd.trace_id,
stdoutData.custom.trace_id
)
assert.strictEqual(
stdoutData['dd']['span_id'],
stdoutData['custom']['span_id']
stdoutData.dd.span_id,
stdoutData.custom.span_id
)
})

Expand Down
3 changes: 2 additions & 1 deletion integration-tests/playwright/playwright.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ versions.forEach((version) => {
context(`reporting via ${reportMethod}`, () => {
it('can run and report tests', (done) => {
const envVars = reportMethod === 'agentless'
? getCiVisAgentlessConfig(receiver.port) : getCiVisEvpProxyConfig(receiver.port)
? getCiVisAgentlessConfig(receiver.port)
: getCiVisEvpProxyConfig(receiver.port)
const reportUrl = reportMethod === 'agentless' ? '/api/v2/citestcycle' : '/evp_proxy/v2/api/v2/citestcycle'

receiver.gatherPayloadsMaxTimeout(({ url }) => url === reportUrl, payloads => {
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/profiler/profiler.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ describe('profiler', () => {
})
})
})
const [ port1, port2 ] = await p
const [port1, port2] = await p
const args = [String(port1), String(port2), msg]
// Invoke the profiled program, passing it the ports of the servers and
// the expected message.
Expand Down
6 changes: 4 additions & 2 deletions node-upstream-tests/node/run_tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ const childProcess = require('child_process')
const path = require('path')
const fsUtils = require('./fs_utils')

const NODE_BIN = process.env['NODE_BIN'] || '/usr/bin/node'
const NODE_REPO_PATH = process.env['NODE_REPO_PATH']
const NODE_BIN = process.env.NODE_BIN || '/usr/bin/node'
const NODE_REPO_PATH = process.env.NODE_REPO_PATH
if (NODE_REPO_PATH === undefined) {
throw new Error('The env variable NODE_REPO_PATH is not set. This is required to locate the root of the nodejs repo')
}
Expand Down Expand Up @@ -244,6 +244,7 @@ class TestResult {
this.isPass = null
this.isIgnore = null
}

async init () {
this.isPass = this.rc === 0

Expand All @@ -257,6 +258,7 @@ class TestResult {

return this
}

errorMessage () {
let message = ''
message += `Test output: rc ${this.rc}\n`
Expand Down
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -116,11 +116,10 @@
"dotenv": "16.3.1",
"esbuild": "0.16.12",
"eslint": "^8.23.0",
"eslint-config-standard": "^11.0.0-beta.0",
"eslint-config-standard": "^17.1.0",
"eslint-plugin-import": "^2.8.0",
"eslint-plugin-mocha": "^10.1.0",
"eslint-plugin-n": "^15.7.0",
"eslint-plugin-node": "^5.2.1",
"eslint-plugin-promise": "^3.6.0",
"eslint-plugin-standard": "^3.0.1",
"express": "^4.18.2",
Expand Down
4 changes: 2 additions & 2 deletions packages/datadog-core/test/utils/src/get.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ const get = require('../../../src/utils/src/get')

describe('get', () => {
const obj = {
'a': {
'b': 'c'
a: {
b: 'c'
}
}

Expand Down
Loading
Loading