From 76d76e077b7b304ffe8d8031323c9f249a225016 Mon Sep 17 00:00:00 2001 From: Stephen Belanger Date: Thu, 21 Mar 2024 02:48:39 -0700 Subject: [PATCH] Update standard to remove eslint-plugin-node (#4146) --- .eslintignore | 2 + .eslintrc.json | 4 +- LICENSE-3rdparty.csv | 1 - benchmark/dd-trace.js | 24 +- benchmark/e2e-ci/benchmark-run.js | 4 +- benchmark/e2e/benchmark-run.js | 4 +- .../e2e/express-helloworld-manyroutes/app.js | 1 - benchmark/profiler/index.js | 2 +- benchmark/sirun/get-results.js | 12 +- benchmark/sirun/plugin-graphql/index.js | 2 +- benchmark/sirun/plugin-graphql/schema.js | 2 +- benchmark/sirun/scope/index.js | 1 - benchmark/sirun/squash-affinity.js | 2 +- ci/init.js | 6 +- integration-tests/ci-visibility.spec.js | 15 +- .../ci-visibility/features/support/steps.js | 3 + .../jest-custom-test-sequencer.js | 1 + integration-tests/cucumber/cucumber.spec.js | 4 +- integration-tests/cypress/cypress.spec.js | 6 +- integration-tests/esbuild/aws-sdk.js | 2 +- .../esbuild/build-and-test-aws-sdk.js | 2 +- integration-tests/graphql.spec.js | 2 +- integration-tests/pino.spec.js | 8 +- .../playwright/playwright.spec.js | 3 +- integration-tests/profiler/profiler.spec.js | 2 +- node-upstream-tests/node/run_tests.js | 6 +- package.json | 3 +- .../datadog-core/test/utils/src/get.spec.js | 4 +- .../datadog-core/test/utils/src/has.spec.js | 4 +- packages/datadog-esbuild/index.js | 4 +- .../src/apollo-server.js | 2 +- .../datadog-instrumentations/src/aws-sdk.js | 5 +- .../src/cassandra-driver.js | 2 +- .../datadog-instrumentations/src/cucumber.js | 6 +- packages/datadog-instrumentations/src/fs.js | 1 - .../src/google-cloud-pubsub.js | 2 +- .../src/helpers/hooks.js | 112 +-- .../src/helpers/instrument.js | 4 +- .../src/http/client.js | 1 + packages/datadog-instrumentations/src/jest.js | 10 +- .../datadog-instrumentations/src/kafkajs.js | 3 +- .../datadog-instrumentations/src/ldapjs.js | 3 +- .../datadog-instrumentations/src/mocha.js | 2 +- .../src/mongodb-core.js | 6 +- packages/datadog-instrumentations/src/net.js | 2 +- .../src/passport-utils.js | 1 + packages/datadog-instrumentations/src/rhea.js | 7 +- .../datadog-instrumentations/src/tedious.js | 2 +- .../test/child_process.spec.js | 12 +- .../test/express-mongo-sanitize.spec.js | 14 +- .../test/generic-pool.spec.js | 1 + .../test/mongoose.spec.js | 31 +- .../test/passport-http.spec.js | 6 +- .../test/passport-local.spec.js | 2 +- .../test/index.spec.js | 17 +- .../datadog-plugin-aerospike/test/naming.js | 2 +- .../test/integration-test/client.spec.js | 2 +- packages/datadog-plugin-amqp10/test/naming.js | 2 +- .../datadog-plugin-amqplib/test/index.spec.js | 1 + .../test/integration-test/client.spec.js | 2 +- .../datadog-plugin-amqplib/test/naming.js | 2 +- .../src/gateway/fetch.js | 2 +- .../datadog-plugin-apollo/src/gateway/plan.js | 1 - .../src/gateway/request.js | 2 +- .../datadog-plugin-apollo/test/index.spec.js | 12 +- packages/datadog-plugin-apollo/test/naming.js | 2 +- packages/datadog-plugin-aws-sdk/src/base.js | 6 +- .../src/services/cloudwatchlogs.js | 2 +- .../src/services/dynamodb.js | 4 +- .../src/services/eventbridge.js | 2 +- .../src/services/kinesis.js | 2 +- .../src/services/lambda.js | 2 +- .../src/services/redshift.js | 2 +- .../datadog-plugin-aws-sdk/src/services/s3.js | 2 +- .../src/services/sns.js | 2 +- .../src/services/sqs.js | 4 +- .../test/aws-sdk.spec.js | 18 +- .../test/eventbridge.spec.js | 10 +- .../test/fixtures/cloudwatchlogs.js | 2 +- .../test/fixtures/dynamodb.js | 22 +- .../test/fixtures/kinesis.js | 2 +- .../test/fixtures/redshift.js | 4 +- .../test/fixtures/s3.js | 4 +- .../test/fixtures/sns.js | 4 +- .../test/fixtures/sqs.js | 6 +- .../test/integration-test/client.spec.js | 6 +- .../test/kinesis.spec.js | 6 +- .../test/lambda.spec.js | 6 +- .../datadog-plugin-aws-sdk/test/s3.spec.js | 6 +- .../datadog-plugin-aws-sdk/test/sns.spec.js | 6 +- .../test/spec_helpers.js | 8 +- .../datadog-plugin-aws-sdk/test/sqs.spec.js | 10 +- .../test/integration-test/client.spec.js | 2 +- .../test/integration-test/client.spec.js | 2 +- .../test/index.spec.js | 2 +- .../test/integration-test/client.spec.js | 2 +- .../test/naming.js | 2 +- .../datadog-plugin-child_process/src/index.js | 2 +- .../test/index.spec.js | 12 +- .../datadog-plugin-connect/test/index.spec.js | 3 + .../test/integration-test/client.spec.js | 2 +- .../datadog-plugin-couchbase/src/index.js | 3 +- .../test/integration-test/client.spec.js | 2 +- .../test/index.spec.js | 6 +- .../datadog-plugin-cypress/test/index.spec.js | 3 +- .../datadog-plugin-dns/test/index.spec.js | 16 +- .../test/integration-test/client.spec.js | 2 +- .../test/integration-test/client.spec.js | 2 +- .../test/naming.js | 2 +- .../datadog-plugin-express/test/index.spec.js | 5 + .../test/integration-test/client.spec.js | 2 +- packages/datadog-plugin-express/test/leak.js | 2 +- .../datadog-plugin-fastify/test/index.spec.js | 2 + .../test/integration-test/client.spec.js | 2 +- packages/datadog-plugin-fetch/src/index.js | 2 +- .../datadog-plugin-fetch/test/index.spec.js | 4 +- .../test/integration-test/client.spec.js | 2 +- packages/datadog-plugin-fs/test/index.spec.js | 16 +- .../test/index.spec.js | 16 +- .../test/integration-test/client.spec.js | 4 +- .../test/naming.js | 2 +- .../datadog-plugin-graphql/src/resolve.js | 2 +- .../datadog-plugin-graphql/test/index.spec.js | 72 +- .../test/integration-test/client.spec.js | 2 +- packages/datadog-plugin-graphql/test/leak.js | 4 +- packages/datadog-plugin-grpc/src/client.js | 4 +- packages/datadog-plugin-grpc/src/server.js | 4 +- .../datadog-plugin-grpc/test/client.spec.js | 23 +- .../test/integration-test/client.spec.js | 2 +- packages/datadog-plugin-grpc/test/naming.js | 2 +- .../datadog-plugin-grpc/test/server.spec.js | 3 +- .../test/integration-test/client.spec.js | 2 +- packages/datadog-plugin-http/src/client.js | 4 +- .../datadog-plugin-http/test/client.spec.js | 14 +- .../test/integration-test/client.spec.js | 2 +- .../datadog-plugin-http/test/server.spec.js | 6 +- packages/datadog-plugin-http2/src/client.js | 7 +- .../datadog-plugin-http2/test/client.spec.js | 3 +- .../test/integration-test/client.spec.js | 2 +- .../datadog-plugin-http2/test/server.spec.js | 7 +- .../test/integration-test/client.spec.js | 2 +- .../datadog-plugin-ioredis/test/naming.js | 2 +- packages/datadog-plugin-jest/src/index.js | 1 + .../datadog-plugin-jest/test/util.spec.js | 4 +- .../datadog-plugin-kafkajs/src/consumer.js | 2 +- .../datadog-plugin-kafkajs/src/producer.js | 2 +- .../datadog-plugin-kafkajs/test/index.spec.js | 10 +- .../test/integration-test/client.spec.js | 2 +- .../datadog-plugin-kafkajs/test/naming.js | 2 +- .../datadog-plugin-koa/test/index.spec.js | 4 +- .../test/integration-test/client.spec.js | 2 +- .../test/integration-test/client.spec.js | 2 +- .../datadog-plugin-mariadb/test/index.spec.js | 1 + .../test/integration-test/client.spec.js | 2 +- .../datadog-plugin-mariadb/test/naming.js | 2 +- .../test/integration-test/client.spec.js | 2 +- .../datadog-plugin-memcached/test/naming.js | 2 +- .../test/integration-test/client.spec.js | 2 +- .../test/proxy.js | 1 + .../datadog-plugin-mocha/test/index.spec.js | 6 +- .../test/integration-test/client.spec.js | 2 +- .../datadog-plugin-moleculer/test/naming.js | 2 +- .../test/core.spec.js | 10 +- .../test/integration-test/client.spec.js | 4 +- .../datadog-plugin-mongodb-core/test/leak.js | 2 +- .../test/mongodb.spec.js | 16 +- .../test/naming.js | 2 +- .../test/integration-test/client.spec.js | 2 +- .../datadog-plugin-mysql/test/index.spec.js | 5 +- .../test/integration-test/client.spec.js | 2 +- packages/datadog-plugin-mysql/test/naming.js | 2 +- .../datadog-plugin-mysql2/test/index.spec.js | 5 +- .../test/integration-test/client.spec.js | 2 +- packages/datadog-plugin-mysql2/test/naming.js | 2 +- .../datadog-plugin-net/test/index.spec.js | 8 +- .../test/integration-test/client.spec.js | 2 +- packages/datadog-plugin-next/src/index.js | 2 +- packages/datadog-plugin-next/test/datadog.js | 14 +- .../datadog-plugin-next/test/index.spec.js | 27 +- .../test/integration-test/client.spec.js | 6 +- packages/datadog-plugin-next/test/server.js | 1 + packages/datadog-plugin-openai/src/index.js | 8 +- .../datadog-plugin-openai/test/index.spec.js | 876 +++++++++--------- .../test/integration-test/client.spec.js | 2 +- .../test/integration-test/client.spec.js | 2 +- .../datadog-plugin-opensearch/test/naming.js | 2 +- .../test/integration-test/client.spec.js | 2 +- .../datadog-plugin-oracledb/test/naming.js | 2 +- packages/datadog-plugin-pg/test/index.spec.js | 8 +- .../test/integration-test/client.spec.js | 2 +- packages/datadog-plugin-pg/test/naming.js | 2 +- .../datadog-plugin-pino/test/index.spec.js | 2 +- .../test/integration-test/client.spec.js | 2 +- .../test/integration-test/client.spec.js | 2 +- packages/datadog-plugin-redis/test/naming.js | 2 +- .../test/integration-test/client.spec.js | 2 +- packages/datadog-plugin-rhea/src/consumer.js | 2 +- packages/datadog-plugin-rhea/src/producer.js | 2 +- .../datadog-plugin-rhea/test/index.spec.js | 14 +- .../test/integration-test/client.spec.js | 2 +- packages/datadog-plugin-rhea/test/naming.js | 2 +- packages/datadog-plugin-router/src/index.js | 2 +- .../datadog-plugin-router/test/index.spec.js | 1 + .../test/integration-test/client.spec.js | 2 +- .../test/integration-test/client.spec.js | 2 +- packages/datadog-plugin-tedious/src/index.js | 2 +- .../test/integration-test/client.spec.js | 2 +- .../datadog-plugin-tedious/test/naming.js | 2 +- .../test/integration-test/client.spec.js | 2 +- packages/dd-trace/src/appsec/blocking.js | 2 +- .../src/appsec/iast/analyzers/analyzers.js | 34 +- .../appsec/iast/analyzers/cookie-analyzer.js | 1 + .../iast/analyzers/hardcoded-secrets-rules.js | 264 +++--- .../analyzers/hsts-header-missing-analyzer.js | 1 + .../src/appsec/iast/overhead-controller.js | 3 +- .../src/appsec/iast/taint-tracking/index.js | 6 +- .../src/appsec/iast/taint-tracking/plugin.js | 8 +- .../taint-tracking/taint-tracking-impl.js | 2 +- .../sql-sensitive-analyzer.js | 2 +- .../src/appsec/waf/waf_context_wrapper.js | 4 +- .../exporters/git/git_metadata.js | 1 - .../get-skippable-suites.js | 3 +- .../test-api-manual/test-api-manual-plugin.js | 1 + packages/dd-trace/src/config.js | 26 +- packages/dd-trace/src/datastreams/pathway.js | 2 +- .../dd-trace/src/datastreams/processor.js | 30 +- .../src/encode/agentless-ci-visibility.js | 4 +- .../src/encode/coverage-ci-visibility.js | 2 +- .../dd-trace/src/exporters/common/request.js | 1 + .../src/exporters/span-stats/writer.js | 1 - .../dd-trace/src/external-logger/src/index.js | 10 +- packages/dd-trace/src/opentelemetry/span.js | 2 + .../src/opentracing/propagation/text_map.js | 2 +- packages/dd-trace/src/opentracing/span.js | 2 +- packages/dd-trace/src/plugins/composite.js | 7 +- packages/dd-trace/src/plugins/database.js | 1 + packages/dd-trace/src/plugins/index.js | 86 +- packages/dd-trace/src/plugins/plugin.js | 2 +- packages/dd-trace/src/plugins/tracing.js | 2 +- packages/dd-trace/src/plugins/util/test.js | 3 +- packages/dd-trace/src/plugins/util/web.js | 8 +- packages/dd-trace/src/profiling/config.js | 2 +- .../dd-trace/src/profiling/loggers/console.js | 2 +- .../src/profiling/profilers/events.js | 2 +- packages/dd-trace/src/runtime_metrics.js | 13 +- packages/dd-trace/src/serverless.js | 5 +- .../src/service-naming/schemas/v1/storage.js | 1 - packages/dd-trace/src/span_processor.js | 4 +- packages/dd-trace/src/span_stats.js | 2 +- .../dd-trace/src/telemetry/dependencies.js | 9 +- packages/dd-trace/src/telemetry/index.js | 25 +- packages/dd-trace/src/telemetry/send-data.js | 1 - packages/dd-trace/src/util.js | 14 +- .../dd-trace/test/appsec/blocking.spec.js | 2 +- packages/dd-trace/test/appsec/graphql.spec.js | 8 +- .../header-injection.express.plugin.spec.js | 4 +- .../analyzers/path-traversal-analyzer.spec.js | 12 +- .../resources/fs-async-way-method.js | 1 + .../analyzers/sql-injection-analyzer.spec.js | 12 +- .../test/appsec/iast/iast-plugin.spec.js | 6 +- .../test/appsec/iast/path-line.spec.js | 7 +- .../taint-tracking-impl.spec.js | 4 +- packages/dd-trace/test/appsec/iast/utils.js | 4 +- .../vulnerability-formatter/utils.spec.js | 12 +- .../test/appsec/index.express.plugin.spec.js | 8 +- .../test/appsec/index.next.plugin.spec.js | 7 +- packages/dd-trace/test/appsec/index.spec.js | 22 +- .../test/appsec/next/pages-dir/server.js | 1 + .../dd-trace/test/appsec/reporter.spec.js | 2 +- .../dd-trace/test/appsec/rule_manager.spec.js | 76 +- .../dd-trace/test/appsec/waf/index.spec.js | 26 +- .../exporters/ci-visibility-exporter.spec.js | 40 +- packages/dd-trace/test/config.spec.js | 6 +- .../dd-trace/test/datastreams/writer.spec.js | 2 +- packages/dd-trace/test/dogstatsd.spec.js | 6 +- packages/dd-trace/test/encode/0.4.spec.js | 2 +- packages/dd-trace/test/encode/0.5.spec.js | 2 +- .../test/exporters/common/request.spec.js | 4 + packages/dd-trace/test/format.spec.js | 22 +- packages/dd-trace/test/id.spec.js | 2 +- packages/dd-trace/test/lambda/index.spec.js | 2 +- .../dd-trace/test/opentelemetry/span.spec.js | 6 +- .../opentracing/propagation/text_map.spec.js | 84 +- .../dd-trace/test/opentracing/span.spec.js | 4 +- .../dd-trace/test/opentracing/tracer.spec.js | 10 +- packages/dd-trace/test/pkg.spec.js | 4 +- packages/dd-trace/test/plugin_manager.spec.js | 2 +- packages/dd-trace/test/plugins/agent.js | 2 +- .../dd-trace/test/plugins/outbound.spec.js | 6 +- packages/dd-trace/test/plugins/suite.js | 5 +- .../dd-trace/test/plugins/tracing.spec.js | 2 +- .../dd-trace/test/plugins/util/git.spec.js | 22 +- .../plugins/util/test-environment.spec.js | 6 +- .../dd-trace/test/plugins/util/test.spec.js | 14 +- .../dd-trace/test/plugins/util/web.spec.js | 18 +- .../test/profiling/exporters/agent.spec.js | 13 +- .../dd-trace/test/profiling/tagger.spec.js | 2 +- packages/dd-trace/test/proxy.spec.js | 2 + packages/dd-trace/test/sampling_rule.spec.js | 6 +- packages/dd-trace/test/serverless.spec.js | 8 +- packages/dd-trace/test/setup/mocha.js | 12 +- .../dd-trace/test/setup/services/couchbase.js | 2 +- .../test/telemetry/dependencies.spec.js | 4 +- .../dd-trace/test/telemetry/index.spec.js | 38 +- .../test/telemetry/logs/index.spec.js | 2 +- .../dd-trace/test/telemetry/send-data.spec.js | 16 +- scripts/check-proposal-labels.js | 11 +- scripts/install_plugin_modules.js | 5 +- scripts/publish_docs.js | 2 +- yarn.lock | 30 +- 310 files changed, 1648 insertions(+), 1576 deletions(-) diff --git a/.eslintignore b/.eslintignore index 6803a9b63d3..9740ac429fc 100644 --- a/.eslintignore +++ b/.eslintignore @@ -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 diff --git a/.eslintrc.json b/.eslintrc.json index fe6ef889976..4a8615fdac0 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -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 } } diff --git a/LICENSE-3rdparty.csv b/LICENSE-3rdparty.csv index 467bc7a4feb..9565bc3f553 100644 --- a/LICENSE-3rdparty.csv +++ b/LICENSE-3rdparty.csv @@ -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 diff --git a/benchmark/dd-trace.js b/benchmark/dd-trace.js index 41b98f6574e..2254f0d121f 100644 --- a/benchmark/dd-trace.js +++ b/benchmark/dd-trace.js @@ -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() } @@ -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() diff --git a/benchmark/e2e-ci/benchmark-run.js b/benchmark/e2e-ci/benchmark-run.js index c50f0534bd1..8194a1526ef 100644 --- a/benchmark/e2e-ci/benchmark-run.js +++ b/benchmark/e2e-ci/benchmark-run.js @@ -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' } } diff --git a/benchmark/e2e/benchmark-run.js b/benchmark/e2e/benchmark-run.js index 2bd04e6e6f9..6ff18678171 100644 --- a/benchmark/e2e/benchmark-run.js +++ b/benchmark/e2e/benchmark-run.js @@ -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), @@ -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), diff --git a/benchmark/e2e/express-helloworld-manyroutes/app.js b/benchmark/e2e/express-helloworld-manyroutes/app.js index f37144b5068..61729670bb6 100644 --- a/benchmark/e2e/express-helloworld-manyroutes/app.js +++ b/benchmark/e2e/express-helloworld-manyroutes/app.js @@ -1,4 +1,3 @@ - const crypto = require('crypto') const app = require('express')() diff --git a/benchmark/profiler/index.js b/benchmark/profiler/index.js index 556ada232ce..20f1455d05d 100644 --- a/benchmark/profiler/index.js +++ b/benchmark/profiler/index.js @@ -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) diff --git a/benchmark/sirun/get-results.js b/benchmark/sirun/get-results.js index 266cc77337a..c5c65cb72fd 100644 --- a/benchmark/sirun/get-results.js +++ b/benchmark/sirun/get-results.js @@ -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}` diff --git a/benchmark/sirun/plugin-graphql/index.js b/benchmark/sirun/plugin-graphql/index.js index 29ff7f64fd8..cc31b6828a3 100644 --- a/benchmark/sirun/plugin-graphql/index.js +++ b/benchmark/sirun/plugin-graphql/index.js @@ -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 = ` diff --git a/benchmark/sirun/plugin-graphql/schema.js b/benchmark/sirun/plugin-graphql/schema.js index 0c330b5bf71..d7da47739b9 100644 --- a/benchmark/sirun/plugin-graphql/schema.js +++ b/benchmark/sirun/plugin-graphql/schema.js @@ -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', diff --git a/benchmark/sirun/scope/index.js b/benchmark/sirun/scope/index.js index a15c30336b7..20c2f6da2f6 100644 --- a/benchmark/sirun/scope/index.js +++ b/benchmark/sirun/scope/index.js @@ -1,4 +1,3 @@ - const { DD_TRACE_SCOPE, COUNT diff --git a/benchmark/sirun/squash-affinity.js b/benchmark/sirun/squash-affinity.js index c4b8854d073..96e96ab785b 100644 --- a/benchmark/sirun/squash-affinity.js +++ b/benchmark/sirun/squash-affinity.js @@ -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)) diff --git a/ci/init.js b/ci/init.js index 23451c10174..32f3c58f537 100644 --- a/ci/init.js +++ b/ci/init.js @@ -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 { diff --git a/integration-tests/ci-visibility.spec.js b/integration-tests/ci-visibility.spec.js index d765d92029c..0f31b8aa59d 100644 --- a/integration-tests/ci-visibility.spec.js +++ b/integration-tests/ci-visibility.spec.js @@ -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'] }) } @@ -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'] }) } @@ -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'] }) } @@ -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'] }) } @@ -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'] }) } diff --git a/integration-tests/ci-visibility/features/support/steps.js b/integration-tests/ci-visibility/features/support/steps.js index 61dac1a5938..5882703295c 100644 --- a/integration-tests/ci-visibility/features/support/steps.js +++ b/integration-tests/ci-visibility/features/support/steps.js @@ -4,12 +4,15 @@ class Greeter { sayFarewell () { return 'farewell' } + sayGreetings () { return 'greetings' } + sayYo () { return 'yo' } + sayYeah () { return 'yeah whatever' } diff --git a/integration-tests/ci-visibility/jest-custom-test-sequencer.js b/integration-tests/ci-visibility/jest-custom-test-sequencer.js index c2beca115de..b78e0afc531 100644 --- a/integration-tests/ci-visibility/jest-custom-test-sequencer.js +++ b/integration-tests/ci-visibility/jest-custom-test-sequencer.js @@ -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)) diff --git a/integration-tests/cucumber/cucumber.spec.js b/integration-tests/cucumber/cucumber.spec.js index 897ef7e18f9..2e8eb6a6b84 100644 --- a/integration-tests/cucumber/cucumber.spec.js +++ b/integration-tests/cucumber/cucumber.spec.js @@ -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' } diff --git a/integration-tests/cypress/cypress.spec.js b/integration-tests/cypress/cypress.spec.js index 1a94c6f8185..09c95b192cb 100644 --- a/integration-tests/cypress/cypress.spec.js +++ b/integration-tests/cypress/cypress.spec.js @@ -75,7 +75,7 @@ moduleType.forEach(({ before(async () => { // cypress-fail-fast is required as an incompatible plugin - sandbox = await createSandbox([`cypress@${version}`, `cypress-fail-fast@7.1.0`], true) + sandbox = await createSandbox([`cypress@${version}`, 'cypress-fail-fast@7.1.0'], true) cwd = sandbox.folder webAppPort = await getPort() webAppServer.listen(webAppPort) @@ -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' @@ -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' diff --git a/integration-tests/esbuild/aws-sdk.js b/integration-tests/esbuild/aws-sdk.js index 9f8a63ab8ae..c89f570689b 100644 --- a/integration-tests/esbuild/aws-sdk.js +++ b/integration-tests/esbuild/aws-sdk.js @@ -2,4 +2,4 @@ require('../../').init() // dd-trace const aws = require('aws-sdk') -void aws.util.inherit +global.test = aws.util.inherit diff --git a/integration-tests/esbuild/build-and-test-aws-sdk.js b/integration-tests/esbuild/build-and-test-aws-sdk.js index 116615f9f63..a270d6948fc 100755 --- a/integration-tests/esbuild/build-and-test-aws-sdk.js +++ b/integration-tests/esbuild/build-and-test-aws-sdk.js @@ -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) { diff --git a/integration-tests/graphql.spec.js b/integration-tests/graphql.spec.js index 4a7c8e14917..4a66f163a83 100644 --- a/integration-tests/graphql.spec.js +++ b/integration-tests/graphql.spec.js @@ -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() diff --git a/integration-tests/pino.spec.js b/integration-tests/pino.spec.js index a28bf72a08b..4566eae63fb 100644 --- a/integration-tests/pino.spec.js +++ b/integration-tests/pino.spec.js @@ -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 ) }) diff --git a/integration-tests/playwright/playwright.spec.js b/integration-tests/playwright/playwright.spec.js index b50c86139b5..8dde45d7296 100644 --- a/integration-tests/playwright/playwright.spec.js +++ b/integration-tests/playwright/playwright.spec.js @@ -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 => { diff --git a/integration-tests/profiler/profiler.spec.js b/integration-tests/profiler/profiler.spec.js index c9738f2566d..1946e995985 100644 --- a/integration-tests/profiler/profiler.spec.js +++ b/integration-tests/profiler/profiler.spec.js @@ -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. diff --git a/node-upstream-tests/node/run_tests.js b/node-upstream-tests/node/run_tests.js index e8df64c97bf..8f2c758d07e 100644 --- a/node-upstream-tests/node/run_tests.js +++ b/node-upstream-tests/node/run_tests.js @@ -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') } @@ -244,6 +244,7 @@ class TestResult { this.isPass = null this.isIgnore = null } + async init () { this.isPass = this.rc === 0 @@ -257,6 +258,7 @@ class TestResult { return this } + errorMessage () { let message = '' message += `Test output: rc ${this.rc}\n` diff --git a/package.json b/package.json index 7ea93b3a910..ec6dc9020db 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/packages/datadog-core/test/utils/src/get.spec.js b/packages/datadog-core/test/utils/src/get.spec.js index 4815b9bf3ee..8878d16e95f 100644 --- a/packages/datadog-core/test/utils/src/get.spec.js +++ b/packages/datadog-core/test/utils/src/get.spec.js @@ -7,8 +7,8 @@ const get = require('../../../src/utils/src/get') describe('get', () => { const obj = { - 'a': { - 'b': 'c' + a: { + b: 'c' } } diff --git a/packages/datadog-core/test/utils/src/has.spec.js b/packages/datadog-core/test/utils/src/has.spec.js index 54130547ceb..58da7f3f874 100644 --- a/packages/datadog-core/test/utils/src/has.spec.js +++ b/packages/datadog-core/test/utils/src/has.spec.js @@ -7,8 +7,8 @@ const has = require('../../../src/utils/src/has') describe('has', () => { const obj = { - 'a': { - 'b': 'c' + a: { + b: 'c' } } diff --git a/packages/datadog-esbuild/index.js b/packages/datadog-esbuild/index.js index 84454213e7d..4e1e407fb6d 100644 --- a/packages/datadog-esbuild/index.js +++ b/packages/datadog-esbuild/index.js @@ -89,7 +89,7 @@ module.exports.setup = function (build) { let pathToPackageJson try { - pathToPackageJson = require.resolve(`${extracted.pkg}/package.json`, { paths: [ args.resolveDir ] }) + pathToPackageJson = require.resolve(`${extracted.pkg}/package.json`, { paths: [args.resolveDir] }) } catch (err) { if (err.code === 'MODULE_NOT_FOUND') { if (!internal) { @@ -173,7 +173,7 @@ function dotFriendlyResolve (path, directory) { path = '../' } - return require.resolve(path, { paths: [ directory ] }) + return require.resolve(path, { paths: [directory] }) } /** diff --git a/packages/datadog-instrumentations/src/apollo-server.js b/packages/datadog-instrumentations/src/apollo-server.js index c0f4b2bbf69..1278949372f 100644 --- a/packages/datadog-instrumentations/src/apollo-server.js +++ b/packages/datadog-instrumentations/src/apollo-server.js @@ -37,7 +37,7 @@ function wrapExecuteHTTPGraphQLRequest (originalExecuteHTTPGraphQLRequest) { }) resolve({ - headers: headers, + headers, status: abortData.statusCode, body: { kind: 'complete', diff --git a/packages/datadog-instrumentations/src/aws-sdk.js b/packages/datadog-instrumentations/src/aws-sdk.js index 68a20d50301..2b65f5d7b9e 100644 --- a/packages/datadog-instrumentations/src/aws-sdk.js +++ b/packages/datadog-instrumentations/src/aws-sdk.js @@ -111,6 +111,7 @@ function wrapSmithySend (send) { } function wrapCb (cb, serviceName, request, ar) { + // eslint-disable-next-line n/handle-callback-err return function wrappedCb (err, response) { const obj = { request, response } return ar.runInAsyncScope(() => { @@ -163,7 +164,9 @@ function getChannelSuffix (name) { 's3', 'sns', 'sqs' - ].includes(name) ? name : 'default' + ].includes(name) + ? name + : 'default' } addHook({ name: '@smithy/smithy-client', versions: ['>=1.0.3'] }, smithy => { diff --git a/packages/datadog-instrumentations/src/cassandra-driver.js b/packages/datadog-instrumentations/src/cassandra-driver.js index 8482ed33870..d59385af567 100644 --- a/packages/datadog-instrumentations/src/cassandra-driver.js +++ b/packages/datadog-instrumentations/src/cassandra-driver.js @@ -10,7 +10,7 @@ const shimmer = require('../../datadog-shimmer') const startCh = channel('apm:cassandra-driver:query:start') const finishCh = channel('apm:cassandra-driver:query:finish') const errorCh = channel('apm:cassandra-driver:query:error') -const connectCh = channel(`apm:cassandra-driver:query:connect`) +const connectCh = channel('apm:cassandra-driver:query:connect') addHook({ name: 'cassandra-driver', versions: ['>=3.0.0'] }, cassandra => { shimmer.wrap(cassandra.Client.prototype, 'batch', batch => function (queries, options, callback) { diff --git a/packages/datadog-instrumentations/src/cucumber.js b/packages/datadog-instrumentations/src/cucumber.js index 89d4895220c..4a4d67fd86f 100644 --- a/packages/datadog-instrumentations/src/cucumber.js +++ b/packages/datadog-instrumentations/src/cucumber.js @@ -132,7 +132,8 @@ function wrapRun (pl, isLatestVersion) { promise.finally(() => { const result = this.getWorstStepResult() const { status, skipReason, errorMessage } = isLatestVersion - ? getStatusFromResultLatest(result) : getStatusFromResult(result) + ? getStatusFromResultLatest(result) + : getStatusFromResult(result) if (lastStatusByPickleId.has(this.pickle.id)) { lastStatusByPickleId.get(this.pickle.id).push(status) @@ -177,7 +178,8 @@ function wrapRun (pl, isLatestVersion) { promise.then((result) => { const { status, skipReason, errorMessage } = isLatestVersion - ? getStatusFromResultLatest(result) : getStatusFromResult(result) + ? getStatusFromResultLatest(result) + : getStatusFromResult(result) testFinishCh.publish({ isStep: true, status, skipReason, errorMessage }) }) diff --git a/packages/datadog-instrumentations/src/fs.js b/packages/datadog-instrumentations/src/fs.js index 8d009dddb4a..772ba4a0a1b 100644 --- a/packages/datadog-instrumentations/src/fs.js +++ b/packages/datadog-instrumentations/src/fs.js @@ -1,4 +1,3 @@ - 'use strict' const { diff --git a/packages/datadog-instrumentations/src/google-cloud-pubsub.js b/packages/datadog-instrumentations/src/google-cloud-pubsub.js index c0450b93d49..dcc3d8c07b5 100644 --- a/packages/datadog-instrumentations/src/google-cloud-pubsub.js +++ b/packages/datadog-instrumentations/src/google-cloud-pubsub.js @@ -11,7 +11,7 @@ const requestStartCh = channel('apm:google-cloud-pubsub:request:start') const requestFinishCh = channel('apm:google-cloud-pubsub:request:finish') const requestErrorCh = channel('apm:google-cloud-pubsub:request:error') -const receiveStartCh = channel(`apm:google-cloud-pubsub:receive:start`) +const receiveStartCh = channel('apm:google-cloud-pubsub:receive:start') const receiveFinishCh = channel('apm:google-cloud-pubsub:receive:finish') const receiveErrorCh = channel('apm:google-cloud-pubsub:receive:error') diff --git a/packages/datadog-instrumentations/src/helpers/hooks.js b/packages/datadog-instrumentations/src/helpers/hooks.js index 431a742f1d5..db6caa54848 100644 --- a/packages/datadog-instrumentations/src/helpers/hooks.js +++ b/packages/datadog-instrumentations/src/helpers/hooks.js @@ -23,62 +23,62 @@ module.exports = { '@opentelemetry/sdk-trace-node': () => require('../otel-sdk-trace'), '@redis/client': () => require('../redis'), '@smithy/smithy-client': () => require('../aws-sdk'), - 'aerospike': () => require('../aerospike'), - 'amqp10': () => require('../amqp10'), - 'amqplib': () => require('../amqplib'), + aerospike: () => require('../aerospike'), + amqp10: () => require('../amqp10'), + amqplib: () => require('../amqplib'), 'aws-sdk': () => require('../aws-sdk'), - 'bluebird': () => require('../bluebird'), + bluebird: () => require('../bluebird'), 'body-parser': () => require('../body-parser'), - 'bunyan': () => require('../bunyan'), + bunyan: () => require('../bunyan'), 'cassandra-driver': () => require('../cassandra-driver'), - 'child_process': () => require('../child_process'), - 'connect': () => require('../connect'), - 'cookie': () => require('../cookie'), + child_process: () => require('../child_process'), + connect: () => require('../connect'), + cookie: () => require('../cookie'), 'cookie-parser': () => require('../cookie-parser'), - 'couchbase': () => require('../couchbase'), - 'crypto': () => require('../crypto'), - 'cypress': () => require('../cypress'), - 'dns': () => require('../dns'), - 'elasticsearch': () => require('../elasticsearch'), - 'express': () => require('../express'), + couchbase: () => require('../couchbase'), + crypto: () => require('../crypto'), + cypress: () => require('../cypress'), + dns: () => require('../dns'), + elasticsearch: () => require('../elasticsearch'), + express: () => require('../express'), 'express-mongo-sanitize': () => require('../express-mongo-sanitize'), - 'fastify': () => require('../fastify'), + fastify: () => require('../fastify'), 'find-my-way': () => require('../find-my-way'), - 'fs': () => require('../fs'), + fs: () => require('../fs'), 'generic-pool': () => require('../generic-pool'), - 'graphql': () => require('../graphql'), - 'grpc': () => require('../grpc'), - 'hapi': () => require('../hapi'), - 'http': () => require('../http'), - 'http2': () => require('../http2'), - 'https': () => require('../http'), - 'ioredis': () => require('../ioredis'), + graphql: () => require('../graphql'), + grpc: () => require('../grpc'), + hapi: () => require('../hapi'), + http: () => require('../http'), + http2: () => require('../http2'), + https: () => require('../http'), + ioredis: () => require('../ioredis'), 'jest-circus': () => require('../jest'), 'jest-config': () => require('../jest'), 'jest-environment-node': () => require('../jest'), 'jest-environment-jsdom': () => require('../jest'), 'jest-jasmine2': () => require('../jest'), 'jest-worker': () => require('../jest'), - 'knex': () => require('../knex'), - 'koa': () => require('../koa'), + knex: () => require('../knex'), + koa: () => require('../koa'), 'koa-router': () => require('../koa'), - 'kafkajs': () => require('../kafkajs'), - 'ldapjs': () => require('../ldapjs'), + kafkajs: () => require('../kafkajs'), + ldapjs: () => require('../ldapjs'), 'limitd-client': () => require('../limitd-client'), - 'mariadb': () => require('../mariadb'), - 'memcached': () => require('../memcached'), + mariadb: () => require('../mariadb'), + memcached: () => require('../memcached'), 'microgateway-core': () => require('../microgateway-core'), - 'mocha': () => require('../mocha'), + mocha: () => require('../mocha'), 'mocha-each': () => require('../mocha'), - 'moleculer': () => require('../moleculer'), - 'mongodb': () => require('../mongodb'), + moleculer: () => require('../moleculer'), + mongodb: () => require('../mongodb'), 'mongodb-core': () => require('../mongodb-core'), - 'mongoose': () => require('../mongoose'), - 'mquery': () => require('../mquery'), - 'mysql': () => require('../mysql'), - 'mysql2': () => require('../mysql2'), - 'net': () => require('../net'), - 'next': () => require('../next'), + mongoose: () => require('../mongoose'), + mquery: () => require('../mquery'), + mysql: () => require('../mysql'), + mysql2: () => require('../mysql2'), + net: () => require('../net'), + next: () => require('../next'), 'node:child_process': () => require('../child_process'), 'node:crypto': () => require('../crypto'), 'node:dns': () => require('../dns'), @@ -86,26 +86,26 @@ module.exports = { 'node:http2': () => require('../http2'), 'node:https': () => require('../http'), 'node:net': () => require('../net'), - 'oracledb': () => require('../oracledb'), - 'openai': () => require('../openai'), - 'paperplane': () => require('../paperplane'), + oracledb: () => require('../oracledb'), + openai: () => require('../openai'), + paperplane: () => require('../paperplane'), 'passport-http': () => require('../passport-http'), 'passport-local': () => require('../passport-local'), - 'pg': () => require('../pg'), - 'pino': () => require('../pino'), + pg: () => require('../pg'), + pino: () => require('../pino'), 'pino-pretty': () => require('../pino'), - 'playwright': () => require('../playwright'), + playwright: () => require('../playwright'), 'promise-js': () => require('../promise-js'), - 'promise': () => require('../promise'), - 'q': () => require('../q'), - 'qs': () => require('../qs'), - 'redis': () => require('../redis'), - 'restify': () => require('../restify'), - 'rhea': () => require('../rhea'), - 'router': () => require('../router'), - 'sharedb': () => require('../sharedb'), - 'sequelize': () => require('../sequelize'), - 'tedious': () => require('../tedious'), - 'when': () => require('../when'), - 'winston': () => require('../winston') + promise: () => require('../promise'), + q: () => require('../q'), + qs: () => require('../qs'), + redis: () => require('../redis'), + restify: () => require('../restify'), + rhea: () => require('../rhea'), + router: () => require('../router'), + sharedb: () => require('../sharedb'), + sequelize: () => require('../sequelize'), + tedious: () => require('../tedious'), + when: () => require('../when'), + winston: () => require('../winston') } diff --git a/packages/datadog-instrumentations/src/helpers/instrument.js b/packages/datadog-instrumentations/src/helpers/instrument.js index 0ca8b63df48..0889f1e5402 100644 --- a/packages/datadog-instrumentations/src/helpers/instrument.js +++ b/packages/datadog-instrumentations/src/helpers/instrument.js @@ -56,13 +56,13 @@ if (semver.satisfies(process.versions.node, '>=17.8.0')) { bound = this.runInAsyncScope.bind(this, fn, thisArg) } Object.defineProperties(bound, { - 'length': { + length: { configurable: true, enumerable: false, value: fn.length, writable: false }, - 'asyncResource': { + asyncResource: { configurable: true, enumerable: true, value: this, diff --git a/packages/datadog-instrumentations/src/http/client.js b/packages/datadog-instrumentations/src/http/client.js index 89e621e642d..0f2d452f51d 100644 --- a/packages/datadog-instrumentations/src/http/client.js +++ b/packages/datadog-instrumentations/src/http/client.js @@ -155,6 +155,7 @@ function patch (http, methodName) { try { return urlToOptions(new url.URL(inputURL)) } catch (e) { + // eslint-disable-next-line n/no-deprecated-api return url.parse(inputURL) } } else if (inputURL instanceof url.URL) { diff --git a/packages/datadog-instrumentations/src/jest.js b/packages/datadog-instrumentations/src/jest.js index dc1ab7df461..1fb7225fd9f 100644 --- a/packages/datadog-instrumentations/src/jest.js +++ b/packages/datadog-instrumentations/src/jest.js @@ -63,11 +63,11 @@ let hasFilteredSkippableSuites = false const sessionAsyncResource = new AsyncResource('bound-anonymous-fn') const specStatusToTestStatus = { - 'pending': 'skip', - 'disabled': 'skip', - 'todo': 'skip', - 'passed': 'pass', - 'failed': 'fail' + pending: 'skip', + disabled: 'skip', + todo: 'skip', + passed: 'pass', + failed: 'fail' } const asyncResources = new WeakMap() diff --git a/packages/datadog-instrumentations/src/kafkajs.js b/packages/datadog-instrumentations/src/kafkajs.js index 132a9e592b9..d8911a1c6fb 100644 --- a/packages/datadog-instrumentations/src/kafkajs.js +++ b/packages/datadog-instrumentations/src/kafkajs.js @@ -38,7 +38,8 @@ addHook({ name: 'kafkajs', file: 'src/index.js', versions: ['>=1.4'] }, (BaseKaf constructor (options) { super(options) this._brokers = (options.brokers && typeof options.brokers !== 'function') - ? options.brokers.join(',') : undefined + ? options.brokers.join(',') + : undefined } } diff --git a/packages/datadog-instrumentations/src/ldapjs.js b/packages/datadog-instrumentations/src/ldapjs.js index b4df501dfb5..1ce4ed53cc4 100644 --- a/packages/datadog-instrumentations/src/ldapjs.js +++ b/packages/datadog-instrumentations/src/ldapjs.js @@ -76,8 +76,9 @@ addHook({ name: 'ldapjs', versions: ['>=2'] }, ldapjs => { const callbackIndex = getCallbackArgIndex(arguments) if (callbackIndex > -1) { const callback = arguments[callbackIndex] + // eslint-disable-next-line n/handle-callback-err arguments[callbackIndex] = shimmer.wrap(callback, function (err, corkedEmitter) { - if (typeof corkedEmitter === 'object' && typeof corkedEmitter['on'] === 'function') { + if (typeof corkedEmitter === 'object' && typeof corkedEmitter.on === 'function') { wrapEmitter(corkedEmitter) } callback.apply(this, arguments) diff --git a/packages/datadog-instrumentations/src/mocha.js b/packages/datadog-instrumentations/src/mocha.js index 4e45d0624ce..6e26b61c145 100644 --- a/packages/datadog-instrumentations/src/mocha.js +++ b/packages/datadog-instrumentations/src/mocha.js @@ -483,7 +483,7 @@ addHook({ */ shimmer.wrap(Mocha.prototype, 'run', run => function () { if (this.options.parallel) { - log.warn(`Unable to initialize CI Visibility because Mocha is running in parallel mode.`) + log.warn('Unable to initialize CI Visibility because Mocha is running in parallel mode.') return run.apply(this, arguments) } diff --git a/packages/datadog-instrumentations/src/mongodb-core.js b/packages/datadog-instrumentations/src/mongodb-core.js index 1a7309fc24f..b0eba63bbed 100644 --- a/packages/datadog-instrumentations/src/mongodb-core.js +++ b/packages/datadog-instrumentations/src/mongodb-core.js @@ -7,9 +7,9 @@ const { } = require('./helpers/instrument') const shimmer = require('../../datadog-shimmer') -const startCh = channel(`apm:mongodb:query:start`) -const finishCh = channel(`apm:mongodb:query:finish`) -const errorCh = channel(`apm:mongodb:query:error`) +const startCh = channel('apm:mongodb:query:start') +const finishCh = channel('apm:mongodb:query:finish') +const errorCh = channel('apm:mongodb:query:error') addHook({ name: 'mongodb-core', versions: ['2 - 3.1.9'] }, Server => { const serverProto = Server.Server.prototype diff --git a/packages/datadog-instrumentations/src/net.js b/packages/datadog-instrumentations/src/net.js index e2e6ecaefe7..416f467cc86 100644 --- a/packages/datadog-instrumentations/src/net.js +++ b/packages/datadog-instrumentations/src/net.js @@ -15,7 +15,7 @@ const startTCPCh = channel('apm:net:tcp:start') const finishTCPCh = channel('apm:net:tcp:finish') const errorTCPCh = channel('apm:net:tcp:error') -const connectionCh = channel(`apm:net:tcp:connection`) +const connectionCh = channel('apm:net:tcp:connection') const names = ['net', 'node:net'] diff --git a/packages/datadog-instrumentations/src/passport-utils.js b/packages/datadog-instrumentations/src/passport-utils.js index 5af55ca94c0..2d79c5e8e66 100644 --- a/packages/datadog-instrumentations/src/passport-utils.js +++ b/packages/datadog-instrumentations/src/passport-utils.js @@ -10,6 +10,7 @@ function wrapVerifiedAndPublish (username, password, verified, type) { return verified } + // eslint-disable-next-line n/handle-callback-err return shimmer.wrap(verified, function (err, user, info) { const credentials = { type, username } passportVerifyChannel.publish({ credentials, user }) diff --git a/packages/datadog-instrumentations/src/rhea.js b/packages/datadog-instrumentations/src/rhea.js index 61431dcbdfc..8cd6ece9595 100644 --- a/packages/datadog-instrumentations/src/rhea.js +++ b/packages/datadog-instrumentations/src/rhea.js @@ -45,7 +45,9 @@ addHook({ name: 'rhea', versions: ['>=1'], file: 'lib/link.js' }, obj => { const { host, port } = getHostAndPort(this.connection) const targetAddress = this.options && this.options.target && - this.options.target.address ? this.options.target.address : undefined + this.options.target.address + ? this.options.target.address + : undefined const asyncResource = new AsyncResource('bound-anonymous-fn') return asyncResource.runInAsyncScope(() => { @@ -187,7 +189,8 @@ function patchCircularBuffer (proto, Session) { if (shouldPop) { const remoteState = entry.remote_state const state = remoteState && remoteState.constructor - ? entry.remote_state.constructor.composite_type : undefined + ? entry.remote_state.constructor.composite_type + : undefined asyncResource.runInAsyncScope(() => { exports.beforeFinish(entry, state) finishSendCh.publish() diff --git a/packages/datadog-instrumentations/src/tedious.js b/packages/datadog-instrumentations/src/tedious.js index f1094a6d30f..3a80b03ad75 100644 --- a/packages/datadog-instrumentations/src/tedious.js +++ b/packages/datadog-instrumentations/src/tedious.js @@ -7,7 +7,7 @@ const { } = require('./helpers/instrument') const shimmer = require('../../datadog-shimmer') -addHook({ name: 'tedious', versions: [ '>=1.0.0' ] }, tedious => { +addHook({ name: 'tedious', versions: ['>=1.0.0'] }, tedious => { const startCh = channel('apm:tedious:request:start') const finishCh = channel('apm:tedious:request:finish') const errorCh = channel('apm:tedious:request:error') diff --git a/packages/datadog-instrumentations/test/child_process.spec.js b/packages/datadog-instrumentations/test/child_process.spec.js index f21c956affc..ffd002e8a6b 100644 --- a/packages/datadog-instrumentations/test/child_process.spec.js +++ b/packages/datadog-instrumentations/test/child_process.spec.js @@ -33,10 +33,10 @@ describe('child process', () => { asyncFinish = sinon.stub() childProcessChannel.subscribe({ - start: start, + start, end: finish, asyncEnd: asyncFinish, - error: error + error }) childProcess = require(childProcessModuleName) @@ -44,10 +44,10 @@ describe('child process', () => { afterEach(() => { childProcessChannel.unsubscribe({ - start: start, + start, end: finish, asyncEnd: asyncFinish, - error: error + error }) }) @@ -270,14 +270,14 @@ describe('child process', () => { expect(start).to.have.been.calledOnceWith({ command: 'ls', shell: false, - result: result + result }, 'tracing:datadog:child_process:execution:start') expect(finish).to.have.been.calledOnceWith({ command: 'ls', shell: false, - result: result + result }, 'tracing:datadog:child_process:execution:end') diff --git a/packages/datadog-instrumentations/test/express-mongo-sanitize.spec.js b/packages/datadog-instrumentations/test/express-mongo-sanitize.spec.js index d9a314d5abc..7464f83152a 100644 --- a/packages/datadog-instrumentations/test/express-mongo-sanitize.spec.js +++ b/packages/datadog-instrumentations/test/express-mongo-sanitize.spec.js @@ -58,7 +58,7 @@ describe('express-mongo-sanitize', () => { await axios.get(`http://localhost:${port}/?param[$eq]=paramvalue`) expect(requestBody).to.be.calledOnce - expect(requestBody.firstCall.args[0].query.param['$eq']).to.be.undefined + expect(requestBody.firstCall.args[0].query.param.$eq).to.be.undefined }) }) @@ -89,7 +89,7 @@ describe('express-mongo-sanitize', () => { await axios.get(`http://localhost:${port}/?param[$eq]=paramvalue`) expect(requestBody).to.be.calledOnce - expect(requestBody.firstCall.args[0].query.param['$eq']).to.be.undefined + expect(requestBody.firstCall.args[0].query.param.$eq).to.be.undefined }) it('subscription is called with expected parameters without sanitization request', async () => { @@ -111,7 +111,7 @@ describe('express-mongo-sanitize', () => { expect(subscription).to.be.calledOnce expect(subscription.firstCall.args[0].sanitizedProperties) .to.be.deep.equal(['body', 'params', 'headers', 'query']) - expect(subscription.firstCall.args[0].req.query.param['$eq']).to.be.undefined + expect(subscription.firstCall.args[0].req.query.param.$eq).to.be.undefined }) }) }) @@ -150,7 +150,7 @@ describe('express-mongo-sanitize', () => { const objectToSanitize = { unsafeKey: { - '$ne': 'test' + $ne: 'test' }, safeKey: 'safeValue' } @@ -158,7 +158,7 @@ describe('express-mongo-sanitize', () => { const sanitizedObject = expressMongoSanitize.sanitize(objectToSanitize) expect(sanitizedObject.safeKey).to.be.equal(objectToSanitize.safeKey) - expect(sanitizedObject.unsafeKey['$ne']).to.be.undefined + expect(sanitizedObject.unsafeKey.$ne).to.be.undefined }) }) @@ -193,7 +193,7 @@ describe('express-mongo-sanitize', () => { const objectToSanitize = { unsafeKey: { - '$ne': 'test' + $ne: 'test' }, safeKey: 'safeValue' } @@ -201,7 +201,7 @@ describe('express-mongo-sanitize', () => { const sanitizedObject = expressMongoSanitize.sanitize(objectToSanitize) expect(sanitizedObject.safeKey).to.be.equal(objectToSanitize.safeKey) - expect(sanitizedObject.unsafeKey['$ne']).to.be.undefined + expect(sanitizedObject.unsafeKey.$ne).to.be.undefined expect(subscription).to.be.calledOnceWith({ sanitizedObject }) }) }) diff --git a/packages/datadog-instrumentations/test/generic-pool.spec.js b/packages/datadog-instrumentations/test/generic-pool.spec.js index f07d8d6c477..eee62a991ea 100644 --- a/packages/datadog-instrumentations/test/generic-pool.spec.js +++ b/packages/datadog-instrumentations/test/generic-pool.spec.js @@ -28,6 +28,7 @@ describe('Instrumentation', () => { const store = 'store' storage.run(store, () => { + // eslint-disable-next-line n/handle-callback-err pool.acquire((err, resource) => { pool.release(resource) expect(storage.getStore()).to.equal(store) diff --git a/packages/datadog-instrumentations/test/mongoose.spec.js b/packages/datadog-instrumentations/test/mongoose.spec.js index adaae709c82..a97208cd259 100644 --- a/packages/datadog-instrumentations/test/mongoose.spec.js +++ b/packages/datadog-instrumentations/test/mongoose.spec.js @@ -178,6 +178,7 @@ describe('mongoose instrumentations', () => { Test.deleteOne({ type: 'test' }, (err) => { expect(err).to.be.null + // eslint-disable-next-line n/handle-callback-err Test.count({ type: 'test' }, (err, res) => { expect(res).to.be.equal(2) // 3 -> delete 1 -> 2 @@ -258,6 +259,7 @@ describe('mongoose instrumentations', () => { expect(item).not.to.be.null expect(item.name).to.be.equal('test1') + // eslint-disable-next-line n/handle-callback-err Test.count({ type: 'test' }, (err, res) => { expect(res).to.be.equal(2) // 3 -> delete 1 -> 2 @@ -367,7 +369,7 @@ describe('mongoose instrumentations', () => { describe('findOneAndUpdate', () => { if (range !== '>=7') { it('continue working as expected with cb', (done) => { - Test.findOneAndUpdate({ name: 'test1' }, { '$set': { name: 'test1-modified' } }, (err) => { + Test.findOneAndUpdate({ name: 'test1' }, { $set: { name: 'test1-modified' } }, (err) => { expect(err).to.be.null Test.findOne({ name: 'test1-modified' }, (err, item) => { @@ -381,7 +383,7 @@ describe('mongoose instrumentations', () => { } it('continue working as expected with then', (done) => { - Test.findOneAndUpdate({ name: 'test1' }, { '$set': { name: 'test1-modified' } }).then((res) => { + Test.findOneAndUpdate({ name: 'test1' }, { $set: { name: 'test1-modified' } }).then((res) => { Test.findOne({ name: 'test1-modified' }).then((item) => { expect(item).not.to.be.null @@ -390,7 +392,7 @@ describe('mongoose instrumentations', () => { }) }) - testCallbacksCalled('findOneAndUpdate', [{ type: 'test' }, { '$set': { name: 'test1-modified' } }]) + testCallbacksCalled('findOneAndUpdate', [{ type: 'test' }, { $set: { name: 'test1-modified' } }]) }) if (semver.intersects(version, '>=5')) { @@ -398,7 +400,7 @@ describe('mongoose instrumentations', () => { if (range !== '>=7') { it('continue working as expected with cb', (done) => { Test.updateMany({ type: 'test' }, { - '$set': { + $set: { other: 'modified-other' } }, (err) => { @@ -420,9 +422,10 @@ describe('mongoose instrumentations', () => { it('continue working as expected with then', (done) => { Test.updateMany({ type: 'test' }, { - '$set': { + $set: { other: 'modified-other' } + // eslint-disable-next-line n/handle-callback-err }).then((err) => { Test.find({ type: 'test' }).then((items) => { expect(items.length).to.be.equal(3) @@ -436,7 +439,7 @@ describe('mongoose instrumentations', () => { }) }) - testCallbacksCalled('updateMany', [{ type: 'test' }, { '$set': { other: 'modified-other' } }]) + testCallbacksCalled('updateMany', [{ type: 'test' }, { $set: { other: 'modified-other' } }]) }) } @@ -445,7 +448,7 @@ describe('mongoose instrumentations', () => { if (range !== '>=7') { it('continue working as expected with cb', (done) => { Test.updateOne({ name: 'test1' }, { - '$set': { + $set: { other: 'modified-other' } }, (err) => { @@ -463,7 +466,7 @@ describe('mongoose instrumentations', () => { it('continue working as expected with then', (done) => { Test.updateOne({ name: 'test1' }, { - '$set': { + $set: { other: 'modified-other' } }).then(() => { @@ -475,7 +478,7 @@ describe('mongoose instrumentations', () => { }) }) - testCallbacksCalled('updateOne', [{ name: 'test1' }, { '$set': { other: 'modified-other' } }]) + testCallbacksCalled('updateOne', [{ name: 'test1' }, { $set: { other: 'modified-other' } }]) }) } }) @@ -483,8 +486,8 @@ describe('mongoose instrumentations', () => { if (semver.intersects(version, '>=6')) { describe('sanitizeFilter', () => { it('continues working as expected without sanitization', () => { - const source = { 'username': 'test' } - const expected = { 'username': 'test' } + const source = { username: 'test' } + const expected = { username: 'test' } const sanitizedObject = mongoose.sanitizeFilter(source) @@ -492,8 +495,8 @@ describe('mongoose instrumentations', () => { }) it('continues working as expected without sanitization', () => { - const source = { 'username': { '$ne': 'test' } } - const expected = { 'username': { '$eq': { '$ne': 'test' } } } + const source = { username: { $ne: 'test' } } + const expected = { username: { $eq: { $ne: 'test' } } } const sanitizedObject = mongoose.sanitizeFilter(source) @@ -501,7 +504,7 @@ describe('mongoose instrumentations', () => { }) it('channel is published with the result object', () => { - const source = { 'username': { '$ne': 'test' } } + const source = { username: { $ne: 'test' } } const listener = sinon.stub() sanitizeFilterFinishCh.subscribe(listener) diff --git a/packages/datadog-instrumentations/test/passport-http.spec.js b/packages/datadog-instrumentations/test/passport-http.spec.js index e9906f7de0e..68b06abbe5c 100644 --- a/packages/datadog-instrumentations/test/passport-http.spec.js +++ b/packages/datadog-instrumentations/test/passport-http.spec.js @@ -90,7 +90,7 @@ withVersions('passport-http', 'passport-http', version => { const res = await axios.get(`http://localhost:${port}/`, { headers: { // test:1234 - 'Authorization': 'Basic dGVzdDoxMjM0' + Authorization: 'Basic dGVzdDoxMjM0' } }) @@ -108,7 +108,7 @@ withVersions('passport-http', 'passport-http', version => { const res = await axios.get(`http://localhost:${port}/`, { headers: { // test:1234 - 'Authorization': 'Basic dGVzdDoxMjM0' + Authorization: 'Basic dGVzdDoxMjM0' } }) @@ -126,7 +126,7 @@ withVersions('passport-http', 'passport-http', version => { const res = await axios.get(`http://localhost:${port}/`, { headers: { // test:1 - 'Authorization': 'Basic dGVzdDox' + Authorization: 'Basic dGVzdDox' } }) diff --git a/packages/datadog-instrumentations/test/passport-local.spec.js b/packages/datadog-instrumentations/test/passport-local.spec.js index c7a43c50c2e..f31c7a83230 100644 --- a/packages/datadog-instrumentations/test/passport-local.spec.js +++ b/packages/datadog-instrumentations/test/passport-local.spec.js @@ -15,7 +15,7 @@ withVersions('passport-local', 'passport-local', version => { }) before((done) => { const express = require('../../../versions/express').get() - const passport = require(`../../../versions/passport`).get() + const passport = require('../../../versions/passport').get() const LocalStrategy = require(`../../../versions/passport-local@${version}`).get().Strategy const app = express() diff --git a/packages/datadog-plugin-aerospike/test/index.spec.js b/packages/datadog-plugin-aerospike/test/index.spec.js index 6c301943245..eb1e48e6f03 100644 --- a/packages/datadog-plugin-aerospike/test/index.spec.js +++ b/packages/datadog-plugin-aerospike/test/index.spec.js @@ -65,7 +65,7 @@ describe('Plugin', () => { const span = traces[0][0] expect(span).to.have.property('name', expectedSchema.command.opName) expect(span).to.have.property('service', expectedSchema.command.serviceName) - expect(span).to.have.property('resource', `Put`) + expect(span).to.have.property('resource', 'Put') expect(span).to.have.property('type', 'aerospike') expect(span.meta).to.have.property('span.kind', 'client') expect(span.meta).to.have.property('aerospike.key', keyString) @@ -91,7 +91,7 @@ describe('Plugin', () => { const span = traces[0][0] expect(span).to.have.property('name', expectedSchema.command.opName) expect(span).to.have.property('service', expectedSchema.command.serviceName) - expect(span).to.have.property('resource', `Connect`) + expect(span).to.have.property('resource', 'Connect') expect(span).to.have.property('type', 'aerospike') expect(span.meta).to.have.property('span.kind', 'client') expect(span.meta).to.have.property('component', 'aerospike') @@ -108,7 +108,7 @@ describe('Plugin', () => { const span = traces[0][0] expect(span).to.have.property('name', expectedSchema.command.opName) expect(span).to.have.property('service', expectedSchema.command.serviceName) - expect(span).to.have.property('resource', `Get`) + expect(span).to.have.property('resource', 'Get') expect(span).to.have.property('type', 'aerospike') expect(span.meta).to.have.property('span.kind', 'client') expect(span.meta).to.have.property('aerospike.key', keyString) @@ -132,7 +132,7 @@ describe('Plugin', () => { const span = traces[0][0] expect(span).to.have.property('name', expectedSchema.command.opName) expect(span).to.have.property('service', expectedSchema.command.serviceName) - expect(span).to.have.property('resource', `Operate`) + expect(span).to.have.property('resource', 'Operate') expect(span).to.have.property('type', 'aerospike') expect(span.meta).to.have.property('span.kind', 'client') expect(span.meta).to.have.property('aerospike.key', keyString) @@ -163,7 +163,7 @@ describe('Plugin', () => { const span = traces[0][0] expect(span).to.have.property('name', expectedSchema.command.opName) expect(span).to.have.property('service', expectedSchema.command.serviceName) - expect(span).to.have.property('resource', `IndexCreate`) + expect(span).to.have.property('resource', 'IndexCreate') expect(span).to.have.property('type', 'aerospike') expect(span.meta).to.have.property('span.kind', 'client') expect(span.meta).to.have.property('aerospike.namespace', ns) @@ -177,7 +177,7 @@ describe('Plugin', () => { aerospike.connect(config).then(client => { const index = { - ns: ns, + ns, set: 'demo', bin: 'tags', index: 'tags_idx', @@ -195,7 +195,7 @@ describe('Plugin', () => { const span = traces[0][0] expect(span).to.have.property('name', expectedSchema.command.opName) expect(span).to.have.property('service', expectedSchema.command.serviceName) - expect(span).to.have.property('resource', `Query`) + expect(span).to.have.property('resource', 'Query') expect(span).to.have.property('type', 'aerospike') expect(span.meta).to.have.property('span.kind', 'client') expect(span.meta).to.have.property('aerospike.namespace', ns) @@ -207,12 +207,13 @@ describe('Plugin', () => { aerospike.connect(config).then(client => { const index = { - ns: ns, + ns, set: 'demo', bin: 'tags', index: 'tags_idx', datatype: aerospike.indexDataType.STRING } + // eslint-disable-next-line n/handle-callback-err client.createIndex(index, (error, job) => { job.waitUntilDone((waitError) => { const query = client.query(ns, 'demo') diff --git a/packages/datadog-plugin-aerospike/test/naming.js b/packages/datadog-plugin-aerospike/test/naming.js index 75c360d9999..bed64a71625 100644 --- a/packages/datadog-plugin-aerospike/test/naming.js +++ b/packages/datadog-plugin-aerospike/test/naming.js @@ -14,6 +14,6 @@ const rawExpectedSchema = { } module.exports = { - rawExpectedSchema: rawExpectedSchema, + rawExpectedSchema, expectedSchema: resolveNaming(rawExpectedSchema) } diff --git a/packages/datadog-plugin-amqp10/test/integration-test/client.spec.js b/packages/datadog-plugin-amqp10/test/integration-test/client.spec.js index f4f97ee69ce..8deadf31385 100644 --- a/packages/datadog-plugin-amqp10/test/integration-test/client.spec.js +++ b/packages/datadog-plugin-amqp10/test/integration-test/client.spec.js @@ -16,7 +16,7 @@ describe('esm', () => { before(async function () { this.timeout(20000) sandbox = await createSandbox([`'amqp10@${version}'`, 'rhea'], false, [ - `./packages/datadog-plugin-amqp10/test/integration-test/*`]) + './packages/datadog-plugin-amqp10/test/integration-test/*']) }) after(async () => { diff --git a/packages/datadog-plugin-amqp10/test/naming.js b/packages/datadog-plugin-amqp10/test/naming.js index 6e9f332cb5e..e8bc0e42c3e 100644 --- a/packages/datadog-plugin-amqp10/test/naming.js +++ b/packages/datadog-plugin-amqp10/test/naming.js @@ -24,6 +24,6 @@ const rawExpectedSchema = { } module.exports = { - rawExpectedSchema: rawExpectedSchema, + rawExpectedSchema, expectedSchema: resolveNaming(rawExpectedSchema) } diff --git a/packages/datadog-plugin-amqplib/test/index.spec.js b/packages/datadog-plugin-amqplib/test/index.spec.js index 784f8d0f23b..d65a5c99338 100644 --- a/packages/datadog-plugin-amqplib/test/index.spec.js +++ b/packages/datadog-plugin-amqplib/test/index.spec.js @@ -276,6 +276,7 @@ describe('Plugin', () => { channel.assertQueue('', {}, (err, ok) => { if (err) return channel.sendToQueue(ok.queue, Buffer.from('content')) + // eslint-disable-next-line n/handle-callback-err channel.consume(ok.queue, () => {}, {}, (err, ok) => {}) }) }, diff --git a/packages/datadog-plugin-amqplib/test/integration-test/client.spec.js b/packages/datadog-plugin-amqplib/test/integration-test/client.spec.js index 1a7f0341210..f7fda5fa651 100644 --- a/packages/datadog-plugin-amqplib/test/integration-test/client.spec.js +++ b/packages/datadog-plugin-amqplib/test/integration-test/client.spec.js @@ -17,7 +17,7 @@ describe('esm', () => { before(async function () { this.timeout(20000) sandbox = await createSandbox([`'amqplib@${version}'`], false, - [`./packages/datadog-plugin-amqplib/test/integration-test/*`]) + ['./packages/datadog-plugin-amqplib/test/integration-test/*']) }) after(async () => { diff --git a/packages/datadog-plugin-amqplib/test/naming.js b/packages/datadog-plugin-amqplib/test/naming.js index ec522c5ed63..fdb90a66d8c 100644 --- a/packages/datadog-plugin-amqplib/test/naming.js +++ b/packages/datadog-plugin-amqplib/test/naming.js @@ -34,6 +34,6 @@ const rawExpectedSchema = { } module.exports = { - rawExpectedSchema: rawExpectedSchema, + rawExpectedSchema, expectedSchema: resolveNaming(rawExpectedSchema) } diff --git a/packages/datadog-plugin-apollo/src/gateway/fetch.js b/packages/datadog-plugin-apollo/src/gateway/fetch.js index acae2472ac7..fc1a3d82837 100644 --- a/packages/datadog-plugin-apollo/src/gateway/fetch.js +++ b/packages/datadog-plugin-apollo/src/gateway/fetch.js @@ -22,7 +22,7 @@ class ApolloGatewayFetchPlugin extends ApolloBasePlugin { const serviceName = ctx?.attributes?.service - if (serviceName) { spanData.meta['serviceName'] = serviceName } + if (serviceName) { spanData.meta.serviceName = serviceName } const span = this.startSpan(this.getOperationName(), spanData, false) diff --git a/packages/datadog-plugin-apollo/src/gateway/plan.js b/packages/datadog-plugin-apollo/src/gateway/plan.js index f7381e11861..33123184cbd 100644 --- a/packages/datadog-plugin-apollo/src/gateway/plan.js +++ b/packages/datadog-plugin-apollo/src/gateway/plan.js @@ -1,4 +1,3 @@ - 'use strict' const ApolloBasePlugin = require('../../../dd-trace/src/plugins/apollo') diff --git a/packages/datadog-plugin-apollo/src/gateway/request.js b/packages/datadog-plugin-apollo/src/gateway/request.js index 0044b57f760..c2503b55eff 100644 --- a/packages/datadog-plugin-apollo/src/gateway/request.js +++ b/packages/datadog-plugin-apollo/src/gateway/request.js @@ -54,7 +54,7 @@ class ApolloGatewayRequestPlugin extends ApolloBasePlugin { const type = operationContext?.operation?.operation const name = operationContext?.operation?.name && operationContext?.operation?.name?.value - spanData['resource'] = getSignature(document, name, type, this?.config?.signature) + spanData.resource = getSignature(document, name, type, this?.config?.signature) spanData.meta['graphql.operation.type'] = type } const span = this.startSpan(this.operationName({ id: `${this.constructor.id}.${this.constructor.operation}` }), diff --git a/packages/datadog-plugin-apollo/test/index.spec.js b/packages/datadog-plugin-apollo/test/index.spec.js index 91986782af5..6718098ef28 100644 --- a/packages/datadog-plugin-apollo/test/index.spec.js +++ b/packages/datadog-plugin-apollo/test/index.spec.js @@ -9,7 +9,7 @@ const getPort = require('get-port') const accounts = require('./fixtures.js') -const graphqlTag = require(`../../../versions/graphql-tag/index.js`).get() +const graphqlTag = require('../../../versions/graphql-tag/index.js').get() const gql = graphqlTag.gql accounts.typeDefs = gql(accounts.typeDefs) @@ -63,7 +63,7 @@ describe('Plugin', () => { before(() => { require('../../dd-trace/index.js') const apollo = require(`../../../versions/@apollo/gateway@${version}`).get() - const subgraph = require(`../../../versions/@apollo/subgraph`).get() + const subgraph = require('../../../versions/@apollo/subgraph').get() buildSubgraphSchema = subgraph.buildSubgraphSchema ApolloGateway = apollo.ApolloGateway LocalGraphQLDataSource = apollo.LocalGraphQLDataSource @@ -123,7 +123,7 @@ describe('Plugin', () => { .catch(done) axios.post(`http://localhost:${port}/`, { - query: query + query }) }) }) @@ -190,7 +190,7 @@ describe('Plugin', () => { }) it('should instrument schema resolver', done => { - const source = `{ hello(name: "world") }` + const source = '{ hello(name: "world") }' agent .use((traces) => { expect(traces[0][0]).to.have.property('name', expectedSchema.server.opName) @@ -244,7 +244,7 @@ describe('Plugin', () => { }) it('should instrument mutations', done => { - const source = `mutation { human { name } }` + const source = 'mutation { human { name } }' agent .use((traces) => { @@ -260,7 +260,7 @@ describe('Plugin', () => { }) it('should handle a circular schema', done => { - const source = `{ human { pets { owner { name } } } }` + const source = '{ human { pets { owner { name } } } }' gateway() .then(({ executor }) => { diff --git a/packages/datadog-plugin-apollo/test/naming.js b/packages/datadog-plugin-apollo/test/naming.js index 15012ce8217..bc8e2247b82 100644 --- a/packages/datadog-plugin-apollo/test/naming.js +++ b/packages/datadog-plugin-apollo/test/naming.js @@ -14,6 +14,6 @@ const rawExpectedSchema = { } module.exports = { - rawExpectedSchema: rawExpectedSchema, + rawExpectedSchema, expectedSchema: resolveNaming(rawExpectedSchema) } diff --git a/packages/datadog-plugin-aws-sdk/src/base.js b/packages/datadog-plugin-aws-sdk/src/base.js index 2e686cdc9f8..21e4bfa47f6 100644 --- a/packages/datadog-plugin-aws-sdk/src/base.js +++ b/packages/datadog-plugin-aws-sdk/src/base.js @@ -37,10 +37,10 @@ class BaseAwsSdkPlugin extends ClientPlugin { 'service.name': this.serviceName(), 'aws.operation': operation, 'aws.region': awsRegion, - 'region': awsRegion, - 'aws_service': awsService, + region: awsRegion, + aws_service: awsService, 'aws.service': awsService, - 'component': 'aws-sdk' + component: 'aws-sdk' } if (this.requestTags) this.requestTags.set(request, tags) diff --git a/packages/datadog-plugin-aws-sdk/src/services/cloudwatchlogs.js b/packages/datadog-plugin-aws-sdk/src/services/cloudwatchlogs.js index f28a5a48185..8ad4c8f1b26 100644 --- a/packages/datadog-plugin-aws-sdk/src/services/cloudwatchlogs.js +++ b/packages/datadog-plugin-aws-sdk/src/services/cloudwatchlogs.js @@ -13,7 +13,7 @@ class CloudwatchLogs extends BaseAwsSdkPlugin { return Object.assign(tags, { 'resource.name': `${operation} ${params.logGroupName}`, 'aws.cloudwatch.logs.log_group_name': params.logGroupName, - 'loggroupname': params.logGroupName + loggroupname: params.logGroupName }) } } diff --git a/packages/datadog-plugin-aws-sdk/src/services/dynamodb.js b/packages/datadog-plugin-aws-sdk/src/services/dynamodb.js index 18412efc22b..e534fe5eb8b 100644 --- a/packages/datadog-plugin-aws-sdk/src/services/dynamodb.js +++ b/packages/datadog-plugin-aws-sdk/src/services/dynamodb.js @@ -14,7 +14,7 @@ class DynamoDb extends BaseAwsSdkPlugin { Object.assign(tags, { 'resource.name': `${operation} ${params.TableName}`, 'aws.dynamodb.table_name': params.TableName, - 'tablename': params.TableName + tablename: params.TableName }) } @@ -30,7 +30,7 @@ class DynamoDb extends BaseAwsSdkPlugin { Object.assign(tags, { 'resource.name': `${operation} ${tableName}`, 'aws.dynamodb.table_name': tableName, - 'tablename': tableName + tablename: tableName }) } } diff --git a/packages/datadog-plugin-aws-sdk/src/services/eventbridge.js b/packages/datadog-plugin-aws-sdk/src/services/eventbridge.js index a38063562ed..9309411564a 100644 --- a/packages/datadog-plugin-aws-sdk/src/services/eventbridge.js +++ b/packages/datadog-plugin-aws-sdk/src/services/eventbridge.js @@ -11,7 +11,7 @@ class EventBridge extends BaseAwsSdkPlugin { return { 'resource.name': operation ? `${operation} ${params.source}` : params.source, 'aws.eventbridge.source': `${params.source}`, - 'rulename': `${rulename}` + rulename: `${rulename}` } } diff --git a/packages/datadog-plugin-aws-sdk/src/services/kinesis.js b/packages/datadog-plugin-aws-sdk/src/services/kinesis.js index 7fc9873c7ac..f33ec7f5dc8 100644 --- a/packages/datadog-plugin-aws-sdk/src/services/kinesis.js +++ b/packages/datadog-plugin-aws-sdk/src/services/kinesis.js @@ -69,7 +69,7 @@ class Kinesis extends BaseAwsSdkPlugin { return { 'resource.name': `${operation} ${params.StreamName}`, 'aws.kinesis.stream_name': params.StreamName, - 'streamname': params.StreamName + streamname: params.StreamName } } diff --git a/packages/datadog-plugin-aws-sdk/src/services/lambda.js b/packages/datadog-plugin-aws-sdk/src/services/lambda.js index 7b6d1e323bc..f6ea874872e 100644 --- a/packages/datadog-plugin-aws-sdk/src/services/lambda.js +++ b/packages/datadog-plugin-aws-sdk/src/services/lambda.js @@ -13,7 +13,7 @@ class Lambda extends BaseAwsSdkPlugin { return Object.assign(tags, { 'resource.name': `${operation} ${params.FunctionName}`, - 'functionname': params.FunctionName, + functionname: params.FunctionName, 'aws.lambda': params.FunctionName }) } diff --git a/packages/datadog-plugin-aws-sdk/src/services/redshift.js b/packages/datadog-plugin-aws-sdk/src/services/redshift.js index 194e38a3381..2d28a400376 100644 --- a/packages/datadog-plugin-aws-sdk/src/services/redshift.js +++ b/packages/datadog-plugin-aws-sdk/src/services/redshift.js @@ -13,7 +13,7 @@ class Redshift extends BaseAwsSdkPlugin { return Object.assign(tags, { 'resource.name': `${operation} ${params.ClusterIdentifier}`, 'aws.redshift.cluster_identifier': params.ClusterIdentifier, - 'clusteridentifier': params.ClusterIdentifier + clusteridentifier: params.ClusterIdentifier }) } } diff --git a/packages/datadog-plugin-aws-sdk/src/services/s3.js b/packages/datadog-plugin-aws-sdk/src/services/s3.js index 3313e8296a4..c306c7ba0a8 100644 --- a/packages/datadog-plugin-aws-sdk/src/services/s3.js +++ b/packages/datadog-plugin-aws-sdk/src/services/s3.js @@ -14,7 +14,7 @@ class S3 extends BaseAwsSdkPlugin { return Object.assign(tags, { 'resource.name': `${operation} ${params.Bucket}`, 'aws.s3.bucket_name': params.Bucket, - 'bucketname': params.Bucket + bucketname: params.Bucket }) } } diff --git a/packages/datadog-plugin-aws-sdk/src/services/sns.js b/packages/datadog-plugin-aws-sdk/src/services/sns.js index 5d1d3b8c708..ee5191ddabc 100644 --- a/packages/datadog-plugin-aws-sdk/src/services/sns.js +++ b/packages/datadog-plugin-aws-sdk/src/services/sns.js @@ -23,7 +23,7 @@ class Sns extends BaseAwsSdkPlugin { return { 'resource.name': `${operation} ${params.TopicArn || response.data.TopicArn}`, 'aws.sns.topic_arn': TopicArn, - 'topicname': topicName + topicname: topicName } // TODO: should arn be sanitized or quantized in some way here, diff --git a/packages/datadog-plugin-aws-sdk/src/services/sqs.js b/packages/datadog-plugin-aws-sdk/src/services/sqs.js index 556dd488158..769d9fc9ac6 100644 --- a/packages/datadog-plugin-aws-sdk/src/services/sqs.js +++ b/packages/datadog-plugin-aws-sdk/src/services/sqs.js @@ -101,7 +101,7 @@ class Sqs extends BaseAwsSdkPlugin { Object.assign(tags, { 'resource.name': `${operation} ${params.QueueName || params.QueueUrl}`, 'aws.sqs.queue_name': params.QueueName || params.QueueUrl, - 'queuename': queueName + queuename: queueName }) switch (operation) { @@ -146,7 +146,7 @@ class Sqs extends BaseAwsSdkPlugin { if (parsedAttributes) { return { datadogContext: this.tracer.extract('text_map', parsedAttributes), - parsedAttributes: parsedAttributes + parsedAttributes } } } diff --git a/packages/datadog-plugin-aws-sdk/test/aws-sdk.spec.js b/packages/datadog-plugin-aws-sdk/test/aws-sdk.spec.js index c7695ecd48c..15a3d4d36e1 100644 --- a/packages/datadog-plugin-aws-sdk/test/aws-sdk.spec.js +++ b/packages/datadog-plugin-aws-sdk/test/aws-sdk.spec.js @@ -35,11 +35,11 @@ describe('Plugin', () => { }) expect(span.meta).to.include({ - 'component': 'aws-sdk', + component: 'aws-sdk', 'aws.region': 'us-east-1', - 'region': 'us-east-1', + region: 'us-east-1', 'aws.service': 'S3', - 'aws_service': 'S3', + aws_service: 'S3', 'aws.operation': 'listBuckets' }) }).then(done, done) @@ -102,11 +102,11 @@ describe('Plugin', () => { }) expect(span.meta).to.include({ - 'component': 'aws-sdk', + component: 'aws-sdk', 'aws.region': 'us-east-1', - 'region': 'us-east-1', + region: 'us-east-1', 'aws.service': 'S3', - 'aws_service': 'S3', + aws_service: 'S3', 'aws.operation': 'listBuckets' }) }).then(done, done) @@ -130,7 +130,7 @@ describe('Plugin', () => { [ERROR_TYPE]: error.name, [ERROR_MESSAGE]: error.message, [ERROR_STACK]: error.stack, - 'component': 'aws-sdk' + component: 'aws-sdk' }) if (semver.intersects(version, '>=2.3.4')) { expect(span.meta['aws.response.request_id']).to.match(/[\w]{8}(-[\w]{4}){3}-[\w]{12}/) @@ -217,7 +217,7 @@ describe('Plugin', () => { request (span, response) { span.setTag('hook.operation', response.request.operation) span.addTags({ - 'error': 0 + error: 0 }) } } @@ -245,7 +245,7 @@ describe('Plugin', () => { expect(span).to.have.property('error', 0) expect(span.meta).to.include({ 'hook.operation': 'listBuckets', - 'component': 'aws-sdk' + component: 'aws-sdk' }) }).then(done, done) diff --git a/packages/datadog-plugin-aws-sdk/test/eventbridge.spec.js b/packages/datadog-plugin-aws-sdk/test/eventbridge.spec.js index 98572b3f833..fbe77151d4c 100644 --- a/packages/datadog-plugin-aws-sdk/test/eventbridge.spec.js +++ b/packages/datadog-plugin-aws-sdk/test/eventbridge.spec.js @@ -55,7 +55,7 @@ describe('EventBridge', () => { expect(eventbridge.generateTags(params, 'putEvent', {})).to.deep.equal({ 'aws.eventbridge.source': 'my.event', 'resource.name': 'putEvent my.event', - 'rulename': 'my-rule-name' + rulename: 'my-rule-name' }) }) it('won\'t create tags for a malformed event', () => { @@ -88,7 +88,7 @@ describe('EventBridge', () => { parentId = '0000000000000000' eventbridge.requestInject(span.context(), request) - expect(request.params).to.deep.equal({ 'Entries': [{ 'Detail': '{"custom":"data","for":"my users","from":"Aaron Stuyvenberg","_datadog":{"x-datadog-trace-id":"456853219676779160","x-datadog-parent-id":"456853219676779160","x-datadog-sampling-priority":"1"}}' }] }) + expect(request.params).to.deep.equal({ Entries: [{ Detail: '{"custom":"data","for":"my users","from":"Aaron Stuyvenberg","_datadog":{"x-datadog-trace-id":"456853219676779160","x-datadog-parent-id":"456853219676779160","x-datadog-sampling-priority":"1"}}' }] }) }) it('skips injecting trace context to Eventbridge if message is full', () => { @@ -133,7 +133,7 @@ describe('EventBridge', () => { expect(eventbridge.generateTags(params, 'putEvent', {})).to.deep.equal({ 'aws.eventbridge.source': 'my.event', 'resource.name': 'putEvent my.event', - 'rulename': '' + rulename: '' }) }) @@ -146,7 +146,7 @@ describe('EventBridge', () => { expect(eventbridge.generateTags(params, null, {})).to.deep.equal({ 'aws.eventbridge.source': 'my.event', 'resource.name': 'my.event', - 'rulename': 'my-rule-name' + rulename: 'my-rule-name' }) }) it('handles null response gracefully', () => { @@ -158,7 +158,7 @@ describe('EventBridge', () => { expect(eventbridge.generateTags(params, 'putEvent', null)).to.deep.equal({ 'aws.eventbridge.source': 'my.event', 'resource.name': 'putEvent my.event', - 'rulename': 'my-rule-name' + rulename: 'my-rule-name' }) }) }) diff --git a/packages/datadog-plugin-aws-sdk/test/fixtures/cloudwatchlogs.js b/packages/datadog-plugin-aws-sdk/test/fixtures/cloudwatchlogs.js index c15270a6470..12e8e1b73a7 100644 --- a/packages/datadog-plugin-aws-sdk/test/fixtures/cloudwatchlogs.js +++ b/packages/datadog-plugin-aws-sdk/test/fixtures/cloudwatchlogs.js @@ -2,7 +2,7 @@ const cloudwatchlogs = {} -cloudwatchlogs['create'] = { +cloudwatchlogs.create = { logGroupName: 'example_cw_log_group' } diff --git a/packages/datadog-plugin-aws-sdk/test/fixtures/dynamodb.js b/packages/datadog-plugin-aws-sdk/test/fixtures/dynamodb.js index ea40d9630a0..50ec28ef6a4 100644 --- a/packages/datadog-plugin-aws-sdk/test/fixtures/dynamodb.js +++ b/packages/datadog-plugin-aws-sdk/test/fixtures/dynamodb.js @@ -2,7 +2,7 @@ const ddb = {} -ddb['create'] = { +ddb.create = { AttributeDefinitions: [ { AttributeName: 'CUSTOMER_ID', @@ -30,29 +30,29 @@ ddb['create'] = { TableName: 'CUSTOMER_LIST' } -ddb['put'] = { +ddb.put = { TableName: 'CUSTOMER_LIST', Item: { - 'CUSTOMER_ID': { N: '001' }, - 'CUSTOMER_NAME': { S: 'Richard Roe' } + CUSTOMER_ID: { N: '001' }, + CUSTOMER_NAME: { S: 'Richard Roe' } } } -ddb['get'] = { +ddb.get = { TableName: 'CUSTOMER_LIST', Key: { - 'CUSTOMER_ID': { N: '001' }, - 'CUSTOMER_NAME': { S: 'Richard Roe' } + CUSTOMER_ID: { N: '001' }, + CUSTOMER_NAME: { S: 'Richard Roe' } } } -ddb['batch'] = { +ddb.batch = { RequestItems: { - 'CUSTOMER_LIST': { + CUSTOMER_LIST: { Keys: [ { - 'CUSTOMER_ID': { N: '001' }, - 'CUSTOMER_NAME': { S: 'Richard Roe' } + CUSTOMER_ID: { N: '001' }, + CUSTOMER_NAME: { S: 'Richard Roe' } } ], ConsistentRead: true diff --git a/packages/datadog-plugin-aws-sdk/test/fixtures/kinesis.js b/packages/datadog-plugin-aws-sdk/test/fixtures/kinesis.js index 5860153a59f..aa993752903 100644 --- a/packages/datadog-plugin-aws-sdk/test/fixtures/kinesis.js +++ b/packages/datadog-plugin-aws-sdk/test/fixtures/kinesis.js @@ -2,7 +2,7 @@ const kinesis = {} -kinesis['describe'] = { +kinesis.describe = { StreamName: 'test_aws_stream' } diff --git a/packages/datadog-plugin-aws-sdk/test/fixtures/redshift.js b/packages/datadog-plugin-aws-sdk/test/fixtures/redshift.js index e736afa5b60..33a37d3488b 100644 --- a/packages/datadog-plugin-aws-sdk/test/fixtures/redshift.js +++ b/packages/datadog-plugin-aws-sdk/test/fixtures/redshift.js @@ -2,14 +2,14 @@ const redshift = {} -redshift['create'] = { +redshift.create = { ClusterIdentifier: 'example_redshift_cluster', MasterUserPassword: 'example_user_password', MasterUsername: 'example_username', NodeType: 'ds2.large' } -redshift['get'] = { +redshift.get = { ClusterIdentifier: 'example_redshift_cluster' } diff --git a/packages/datadog-plugin-aws-sdk/test/fixtures/s3.js b/packages/datadog-plugin-aws-sdk/test/fixtures/s3.js index 026de1204d9..3314ca5209a 100644 --- a/packages/datadog-plugin-aws-sdk/test/fixtures/s3.js +++ b/packages/datadog-plugin-aws-sdk/test/fixtures/s3.js @@ -2,13 +2,13 @@ const s3 = {} -s3['put'] = { +s3.put = { Bucket: 'test-aws-bucket-9bd88aa3-6fc1-44bd-ae3a-ba25f49c3eef', Key: 'test.txt', Body: 'Hello World!' } -s3['create'] = { +s3.create = { Bucket: 'test-aws-bucket-9bd88aa3-6fc1-44bd-ae3a-ba25f49c3eef' } diff --git a/packages/datadog-plugin-aws-sdk/test/fixtures/sns.js b/packages/datadog-plugin-aws-sdk/test/fixtures/sns.js index 9928346b095..8bff110115e 100644 --- a/packages/datadog-plugin-aws-sdk/test/fixtures/sns.js +++ b/packages/datadog-plugin-aws-sdk/test/fixtures/sns.js @@ -2,11 +2,11 @@ const sns = {} -sns['create'] = { +sns.create = { Name: 'example_aws_topic' } -sns['get'] = { +sns.get = { TopicArn: undefined } diff --git a/packages/datadog-plugin-aws-sdk/test/fixtures/sqs.js b/packages/datadog-plugin-aws-sdk/test/fixtures/sqs.js index 0f0030a4735..8680d57d7fa 100644 --- a/packages/datadog-plugin-aws-sdk/test/fixtures/sqs.js +++ b/packages/datadog-plugin-aws-sdk/test/fixtures/sqs.js @@ -2,14 +2,14 @@ const sqs = {} -sqs['create'] = { +sqs.create = { QueueName: 'SQS_QUEUE_NAME', Attributes: { - 'MessageRetentionPeriod': '86400' + MessageRetentionPeriod: '86400' } } -sqs['get'] = { +sqs.get = { QueueUrl: undefined } diff --git a/packages/datadog-plugin-aws-sdk/test/integration-test/client.spec.js b/packages/datadog-plugin-aws-sdk/test/integration-test/client.spec.js index db495f20234..0fdc15ea537 100644 --- a/packages/datadog-plugin-aws-sdk/test/integration-test/client.spec.js +++ b/packages/datadog-plugin-aws-sdk/test/integration-test/client.spec.js @@ -17,7 +17,7 @@ describe('esm', () => { before(async function () { this.timeout(20000) sandbox = await createSandbox([`'aws-sdk@${version}'`], false, [ - `./packages/datadog-plugin-aws-sdk/test/integration-test/*`]) + './packages/datadog-plugin-aws-sdk/test/integration-test/*']) }) after(async () => { @@ -42,8 +42,8 @@ describe('esm', () => { proc = await spawnPluginIntegrationTestProc(sandbox.folder, 'server.mjs', agent.port, undefined, { - 'AWS_SECRET_ACCESS_KEY': '0000000000/00000000000000000000000000000', - 'AWS_ACCESS_KEY_ID': '00000000000000000000' + AWS_SECRET_ACCESS_KEY: '0000000000/00000000000000000000000000000', + AWS_ACCESS_KEY_ID: '00000000000000000000' } ) diff --git a/packages/datadog-plugin-aws-sdk/test/kinesis.spec.js b/packages/datadog-plugin-aws-sdk/test/kinesis.spec.js index f21853e4b70..89518c45cdc 100644 --- a/packages/datadog-plugin-aws-sdk/test/kinesis.spec.js +++ b/packages/datadog-plugin-aws-sdk/test/kinesis.spec.js @@ -128,9 +128,9 @@ describe('Kinesis', function () { agent.use(traces => { const span = traces[0][0] expect(span.meta).to.include({ - 'streamname': streamName, - 'aws_service': 'Kinesis', - 'region': 'us-east-1' + streamname: streamName, + aws_service: 'Kinesis', + region: 'us-east-1' }) expect(span.resource).to.equal(`putRecord ${streamName}`) expect(span.meta).to.have.property('streamname', streamName) diff --git a/packages/datadog-plugin-aws-sdk/test/lambda.spec.js b/packages/datadog-plugin-aws-sdk/test/lambda.spec.js index 4092e933af7..5529a84677d 100644 --- a/packages/datadog-plugin-aws-sdk/test/lambda.spec.js +++ b/packages/datadog-plugin-aws-sdk/test/lambda.spec.js @@ -92,9 +92,9 @@ describe('Plugin', () => { expect(span.resource.startsWith('invoke')).to.equal(true) expect(span.meta).to.include({ - 'functionname': 'ironmaiden', - 'aws_service': 'Lambda', - 'region': 'us-east-1' + functionname: 'ironmaiden', + aws_service: 'Lambda', + region: 'us-east-1' }) const parentId = span.span_id.toString() const traceId = span.trace_id.toString() diff --git a/packages/datadog-plugin-aws-sdk/test/s3.spec.js b/packages/datadog-plugin-aws-sdk/test/s3.spec.js index ab1e3911047..9ffb9a67215 100644 --- a/packages/datadog-plugin-aws-sdk/test/s3.spec.js +++ b/packages/datadog-plugin-aws-sdk/test/s3.spec.js @@ -85,9 +85,9 @@ describe('Plugin', () => { }) expect(span.meta).to.include({ - 'bucketname': bucketName, - 'aws_service': 'S3', - 'region': 'us-east-1' + bucketname: bucketName, + aws_service: 'S3', + region: 'us-east-1' }) total++ diff --git a/packages/datadog-plugin-aws-sdk/test/sns.spec.js b/packages/datadog-plugin-aws-sdk/test/sns.spec.js index c0d38f19489..27f194abc7e 100644 --- a/packages/datadog-plugin-aws-sdk/test/sns.spec.js +++ b/packages/datadog-plugin-aws-sdk/test/sns.spec.js @@ -216,9 +216,9 @@ describe('Sns', () => { expect(span.resource).to.equal(`publish ${TopicArn}`) expect(span.meta).to.include({ 'aws.sns.topic_arn': TopicArn, - 'topicname': 'TestTopic', - 'aws_service': 'SNS', - 'region': 'us-east-1' + topicname: 'TestTopic', + aws_service: 'SNS', + region: 'us-east-1' }) }).then(done, done) diff --git a/packages/datadog-plugin-aws-sdk/test/spec_helpers.js b/packages/datadog-plugin-aws-sdk/test/spec_helpers.js index 821f2486c23..f86f50acd0e 100644 --- a/packages/datadog-plugin-aws-sdk/test/spec_helpers.js +++ b/packages/datadog-plugin-aws-sdk/test/spec_helpers.js @@ -7,13 +7,13 @@ const helpers = { setup () { before(() => { - process.env['AWS_SECRET_ACCESS_KEY'] = '0000000000/00000000000000000000000000000' - process.env['AWS_ACCESS_KEY_ID'] = '00000000000000000000' + process.env.AWS_SECRET_ACCESS_KEY = '0000000000/00000000000000000000000000000' + process.env.AWS_ACCESS_KEY_ID = '00000000000000000000' }) after(() => { - delete process.env['AWS_SECRET_ACCESS_KEY'] - delete process.env['AWS_ACCESS_KEY_ID'] + delete process.env.AWS_SECRET_ACCESS_KEY + delete process.env.AWS_ACCESS_KEY_ID }) } } diff --git a/packages/datadog-plugin-aws-sdk/test/sqs.spec.js b/packages/datadog-plugin-aws-sdk/test/sqs.spec.js index 855fb0a54b8..fee2a918810 100644 --- a/packages/datadog-plugin-aws-sdk/test/sqs.spec.js +++ b/packages/datadog-plugin-aws-sdk/test/sqs.spec.js @@ -12,7 +12,7 @@ const getQueueParams = (queueName) => { return { QueueName: queueName, Attributes: { - 'MessageRetentionPeriod': '86400' + MessageRetentionPeriod: '86400' } } } @@ -117,7 +117,7 @@ describe('Plugin', () => { expect(span.resource.startsWith('sendMessage')).to.equal(true) expect(span.meta).to.include({ - 'queuename': 'SQS_QUEUE_NAME' + queuename: 'SQS_QUEUE_NAME' }) parentId = span.span_id.toString() @@ -269,9 +269,9 @@ describe('Plugin', () => { }) expect(span.meta).to.include({ - 'queuename': 'SQS_QUEUE_NAME', - 'aws_service': 'SQS', - 'region': 'us-east-1' + queuename: 'SQS_QUEUE_NAME', + aws_service: 'SQS', + region: 'us-east-1' }) total++ }).catch(() => {}, { timeoutMs: 100 }) diff --git a/packages/datadog-plugin-axios/test/integration-test/client.spec.js b/packages/datadog-plugin-axios/test/integration-test/client.spec.js index 7a711a74a4d..018cdc7522d 100644 --- a/packages/datadog-plugin-axios/test/integration-test/client.spec.js +++ b/packages/datadog-plugin-axios/test/integration-test/client.spec.js @@ -16,7 +16,7 @@ describe('esm', () => { before(async function () { this.timeout(20000) sandbox = await createSandbox(['axios'], false, [ - `./packages/datadog-plugin-axios/test/integration-test/*`]) + './packages/datadog-plugin-axios/test/integration-test/*']) }) after(async () => { diff --git a/packages/datadog-plugin-bunyan/test/integration-test/client.spec.js b/packages/datadog-plugin-bunyan/test/integration-test/client.spec.js index 9f6688a0354..5ce5d8884fa 100644 --- a/packages/datadog-plugin-bunyan/test/integration-test/client.spec.js +++ b/packages/datadog-plugin-bunyan/test/integration-test/client.spec.js @@ -15,7 +15,7 @@ describe('esm', () => { before(async function () { this.timeout(20000) sandbox = await createSandbox([`'bunyan@${version}'`], false, - [`./packages/datadog-plugin-bunyan/test/integration-test/*`]) + ['./packages/datadog-plugin-bunyan/test/integration-test/*']) }) after(async () => { diff --git a/packages/datadog-plugin-cassandra-driver/test/index.spec.js b/packages/datadog-plugin-cassandra-driver/test/index.spec.js index ddca9a999a7..d10433a04b5 100644 --- a/packages/datadog-plugin-cassandra-driver/test/index.spec.js +++ b/packages/datadog-plugin-cassandra-driver/test/index.spec.js @@ -146,7 +146,7 @@ describe('Plugin', () => { const childOf = tracer.startSpan('test') scope.activate(childOf, () => { - client.batch([`UPDATE test.test SET test='test' WHERE id='1234';`], () => { + client.batch(['UPDATE test.test SET test=\'test\' WHERE id=\'1234\';'], () => { expect(tracer.scope().active()).to.equal(childOf) done() }) diff --git a/packages/datadog-plugin-cassandra-driver/test/integration-test/client.spec.js b/packages/datadog-plugin-cassandra-driver/test/integration-test/client.spec.js index 4b58ba299a1..da680b7fa25 100644 --- a/packages/datadog-plugin-cassandra-driver/test/integration-test/client.spec.js +++ b/packages/datadog-plugin-cassandra-driver/test/integration-test/client.spec.js @@ -22,7 +22,7 @@ describe('esm', () => { before(async function () { this.timeout(20000) sandbox = await createSandbox([`'cassandra-driver@${version}'`], false, [ - `./packages/datadog-plugin-cassandra-driver/test/integration-test/*`]) + './packages/datadog-plugin-cassandra-driver/test/integration-test/*']) }) after(async () => { diff --git a/packages/datadog-plugin-cassandra-driver/test/naming.js b/packages/datadog-plugin-cassandra-driver/test/naming.js index a4a3929ecb5..10d93008b8a 100644 --- a/packages/datadog-plugin-cassandra-driver/test/naming.js +++ b/packages/datadog-plugin-cassandra-driver/test/naming.js @@ -14,6 +14,6 @@ const rawExpectedSchema = { } module.exports = { - rawExpectedSchema: rawExpectedSchema, + rawExpectedSchema, expectedSchema: resolveNaming(rawExpectedSchema) } diff --git a/packages/datadog-plugin-child_process/src/index.js b/packages/datadog-plugin-child_process/src/index.js index b28e242f056..663b46b1183 100644 --- a/packages/datadog-plugin-child_process/src/index.js +++ b/packages/datadog-plugin-child_process/src/index.js @@ -45,7 +45,7 @@ class ChildProcessPlugin extends TracingPlugin { const property = (shell === true) ? 'cmd.shell' : 'cmd.exec' const meta = { - 'component': 'subprocess', + component: 'subprocess', [property]: (shell === true) ? cmdFields.join(' ') : JSON.stringify(cmdFields) } diff --git a/packages/datadog-plugin-child_process/test/index.spec.js b/packages/datadog-plugin-child_process/test/index.spec.js index b836d206d5e..68eefad4e7d 100644 --- a/packages/datadog-plugin-child_process/test/index.spec.js +++ b/packages/datadog-plugin-child_process/test/index.spec.js @@ -56,7 +56,7 @@ describe('Child process plugin', () => { 'resource.name': 'ls', 'span.kind': undefined, 'span.type': 'system', - 'cmd.exec': JSON.stringify([ 'ls', '-l' ]) + 'cmd.exec': JSON.stringify(['ls', '-l']) }, integrationName: 'system' } @@ -102,7 +102,7 @@ describe('Child process plugin', () => { 'resource.name': 'echo', 'span.kind': undefined, 'span.type': 'system', - 'cmd.exec': JSON.stringify([ 'echo', arg, '' ]), + 'cmd.exec': JSON.stringify(['echo', arg, '']), 'cmd.truncated': 'true' }, integrationName: 'system' @@ -153,7 +153,7 @@ describe('Child process plugin', () => { 'resource.name': 'ls', 'span.kind': undefined, 'span.type': 'system', - 'cmd.exec': JSON.stringify([ 'ls', '-l', '', '' ]), + 'cmd.exec': JSON.stringify(['ls', '-l', '', '']), 'cmd.truncated': 'true' }, integrationName: 'system' @@ -359,7 +359,7 @@ describe('Child process plugin', () => { }) it('should be instrumented with error code', (done) => { - const command = [ 'node', '-badOption' ] + const command = ['node', '-badOption'] const options = { stdio: 'pipe' } @@ -473,7 +473,7 @@ describe('Child process plugin', () => { }) it('should be instrumented with error code', (done) => { - const command = [ 'node', '-badOption' ] + const command = ['node', '-badOption'] const options = { stdio: 'pipe' } @@ -524,7 +524,7 @@ describe('Child process plugin', () => { // when a process return an invalid code, in node <=16, in execFileSync with shell:true // an exception is not thrown it('should be instrumented with error code (override shell default behavior)', (done) => { - const command = [ 'node', '-badOption' ] + const command = ['node', '-badOption'] const options = { stdio: 'pipe', shell: true diff --git a/packages/datadog-plugin-connect/test/index.spec.js b/packages/datadog-plugin-connect/test/index.spec.js index 239ab4c09c4..f30b4967d44 100644 --- a/packages/datadog-plugin-connect/test/index.spec.js +++ b/packages/datadog-plugin-connect/test/index.spec.js @@ -491,6 +491,7 @@ describe('Plugin', () => { const error = new Error('boom') app.use((req, res) => { throw error }) + // eslint-disable-next-line n/handle-callback-err app.use((error, req, res, next) => { res.statusCode = 500 res.end() @@ -661,6 +662,7 @@ describe('Plugin', () => { const error = new Error('boom') app.use((req, res) => { throw error }) + // eslint-disable-next-line n/handle-callback-err app.use((error, req, res, next) => { res.statusCode = 500 res.end() @@ -802,6 +804,7 @@ describe('Plugin', () => { const error = new Error('boom') app.use((req, res) => { throw error }) + // eslint-disable-next-line n/handle-callback-err app.use((error, req, res, next) => { res.statusCode = 500 res.end() diff --git a/packages/datadog-plugin-connect/test/integration-test/client.spec.js b/packages/datadog-plugin-connect/test/integration-test/client.spec.js index 78fe5cbcec7..a045ba8bf09 100644 --- a/packages/datadog-plugin-connect/test/integration-test/client.spec.js +++ b/packages/datadog-plugin-connect/test/integration-test/client.spec.js @@ -19,7 +19,7 @@ describe('esm', () => { before(async function () { this.timeout(20000) sandbox = await createSandbox([`'connect@${version}'`], false, [ - `./packages/datadog-plugin-connect/test/integration-test/*`]) + './packages/datadog-plugin-connect/test/integration-test/*']) }) after(async () => { diff --git a/packages/datadog-plugin-couchbase/src/index.js b/packages/datadog-plugin-couchbase/src/index.js index da6ec18ba4b..cb764875de7 100644 --- a/packages/datadog-plugin-couchbase/src/index.js +++ b/packages/datadog-plugin-couchbase/src/index.js @@ -16,7 +16,7 @@ class CouchBasePlugin extends StoragePlugin { startSpan (operation, customTags, store, { bucket, collection, seedNodes }) { const tags = { 'db.type': 'couchbase', - 'component': 'couchbase', + component: 'couchbase', 'resource.name': `couchbase.${operation}`, 'span.kind': this.constructor.kind, 'db.couchbase.seed.nodes': seedNodes @@ -61,6 +61,7 @@ class CouchBasePlugin extends StoragePlugin { this._addCommandSubs('append') this._addCommandSubs('prepend') } + _addCommandSubs (name) { this.addSubs(name, ({ bucket, collection, seedNodes }) => { const store = storage.getStore() diff --git a/packages/datadog-plugin-couchbase/test/integration-test/client.spec.js b/packages/datadog-plugin-couchbase/test/integration-test/client.spec.js index d1d645f5e4b..0359c33afba 100644 --- a/packages/datadog-plugin-couchbase/test/integration-test/client.spec.js +++ b/packages/datadog-plugin-couchbase/test/integration-test/client.spec.js @@ -22,7 +22,7 @@ describe('esm', () => { before(async function () { this.timeout(20000) sandbox = await createSandbox([`'couchbase@${version}'`], false, [ - `./packages/datadog-plugin-couchbase/test/integration-test/*`]) + './packages/datadog-plugin-couchbase/test/integration-test/*']) }) after(async () => { diff --git a/packages/datadog-plugin-cucumber/test/index.spec.js b/packages/datadog-plugin-cucumber/test/index.spec.js index 33e7c753baa..93fcd3913e3 100644 --- a/packages/datadog-plugin-cucumber/test/index.spec.js +++ b/packages/datadog-plugin-cucumber/test/index.spec.js @@ -456,8 +456,10 @@ describe('Plugin', function () { expect(testSpan.name).to.equal('cucumber.test') expect(testSpan.resource.endsWith('simple.feature.hooks fail')).to.equal(true) expect( - testSpan.meta[ERROR_MESSAGE].startsWith(`TypeError: Cannot set property 'boom' of undefined`) || - testSpan.meta[ERROR_MESSAGE].startsWith(`TypeError: Cannot set properties of undefined (setting 'boom')`) + testSpan.meta[ERROR_MESSAGE].startsWith( + 'TypeError: Cannot set property \'boom\' of undefined') || + testSpan.meta[ERROR_MESSAGE].startsWith( + 'TypeError: Cannot set properties of undefined (setting \'boom\')') ).to.equal(true) }) const result = await runCucumber(version, Cucumber, 'simple.js', 'simple.feature', 'hooks fail') diff --git a/packages/datadog-plugin-cypress/test/index.spec.js b/packages/datadog-plugin-cypress/test/index.spec.js index 39dc9855b66..6be933cf88b 100644 --- a/packages/datadog-plugin-cypress/test/index.spec.js +++ b/packages/datadog-plugin-cypress/test/index.spec.js @@ -52,7 +52,8 @@ describe('Plugin', function () { it('instruments tests', function (done) { process.env.DD_TRACE_AGENT_PORT = agentListenPort const testSuiteFolder = semver.intersects(version, '>=10') - ? 'app-10' : 'app' + ? 'app-10' + : 'app' cypressExecutable.run({ project: `./packages/datadog-plugin-cypress/test/${testSuiteFolder}`, diff --git a/packages/datadog-plugin-dns/test/index.spec.js b/packages/datadog-plugin-dns/test/index.spec.js index 3550e06a059..98edb26ad1c 100644 --- a/packages/datadog-plugin-dns/test/index.spec.js +++ b/packages/datadog-plugin-dns/test/index.spec.js @@ -33,7 +33,7 @@ describe('Plugin', () => { resource: 'localhost' }) expect(traces[0][0].meta).to.deep.include({ - 'component': 'dns', + component: 'dns', 'span.kind': 'client', 'dns.hostname': 'localhost', 'dns.address': '127.0.0.1' @@ -54,7 +54,7 @@ describe('Plugin', () => { resource: 'localhost' }) expect(traces[0][0].meta).to.deep.include({ - 'component': 'dns', + component: 'dns', 'span.kind': 'client', 'dns.hostname': 'localhost', 'dns.address': '127.0.0.1', @@ -77,7 +77,7 @@ describe('Plugin', () => { error: 1 }) expect(traces[0][0].meta).to.deep.include({ - 'component': 'dns', + component: 'dns', 'span.kind': 'client', 'dns.hostname': 'fakedomain.faketld', [ERROR_TYPE]: 'Error', @@ -101,7 +101,7 @@ describe('Plugin', () => { resource: '127.0.0.1:22' }) expect(traces[0][0].meta).to.deep.include({ - 'component': 'dns', + component: 'dns', 'span.kind': 'client', 'dns.address': '127.0.0.1' }) @@ -124,7 +124,7 @@ describe('Plugin', () => { resource: 'A lvh.me' }) expect(traces[0][0].meta).to.deep.include({ - 'component': 'dns', + component: 'dns', 'span.kind': 'client', 'dns.hostname': 'lvh.me', 'dns.rrtype': 'A' @@ -145,7 +145,7 @@ describe('Plugin', () => { resource: 'ANY lvh.me' }) expect(traces[0][0].meta).to.deep.include({ - 'component': 'dns', + component: 'dns', 'span.kind': 'client', 'dns.hostname': 'lvh.me', 'dns.rrtype': 'ANY' @@ -166,7 +166,7 @@ describe('Plugin', () => { resource: '127.0.0.1' }) expect(traces[0][0].meta).to.deep.include({ - 'component': 'dns', + component: 'dns', 'span.kind': 'client', 'dns.ip': '127.0.0.1' }) @@ -211,7 +211,7 @@ describe('Plugin', () => { resource: 'A lvh.me' }) expect(traces[0][0].meta).to.deep.include({ - 'component': 'dns', + component: 'dns', 'dns.hostname': 'lvh.me', 'dns.rrtype': 'A' }) diff --git a/packages/datadog-plugin-dns/test/integration-test/client.spec.js b/packages/datadog-plugin-dns/test/integration-test/client.spec.js index b1578dcce79..4a2f5113458 100644 --- a/packages/datadog-plugin-dns/test/integration-test/client.spec.js +++ b/packages/datadog-plugin-dns/test/integration-test/client.spec.js @@ -16,7 +16,7 @@ describe('esm', () => { before(async function () { this.timeout(20000) sandbox = await createSandbox([], false, [ - `./packages/datadog-plugin-dns/test/integration-test/*`]) + './packages/datadog-plugin-dns/test/integration-test/*']) }) after(async () => { diff --git a/packages/datadog-plugin-elasticsearch/test/integration-test/client.spec.js b/packages/datadog-plugin-elasticsearch/test/integration-test/client.spec.js index a676b5ab8bb..eacd384c033 100644 --- a/packages/datadog-plugin-elasticsearch/test/integration-test/client.spec.js +++ b/packages/datadog-plugin-elasticsearch/test/integration-test/client.spec.js @@ -17,7 +17,7 @@ describe('esm', () => { before(async function () { this.timeout(20000) sandbox = await createSandbox([`'@elastic/elasticsearch@${version}'`], false, [ - `./packages/datadog-plugin-elasticsearch/test/integration-test/*`]) + './packages/datadog-plugin-elasticsearch/test/integration-test/*']) }) after(async () => { diff --git a/packages/datadog-plugin-elasticsearch/test/naming.js b/packages/datadog-plugin-elasticsearch/test/naming.js index d7c1fc2a952..737c724d81b 100644 --- a/packages/datadog-plugin-elasticsearch/test/naming.js +++ b/packages/datadog-plugin-elasticsearch/test/naming.js @@ -14,6 +14,6 @@ const rawExpectedSchema = { } module.exports = { - rawExpectedSchema: rawExpectedSchema, + rawExpectedSchema, expectedSchema: resolveNaming(rawExpectedSchema) } diff --git a/packages/datadog-plugin-express/test/index.spec.js b/packages/datadog-plugin-express/test/index.spec.js index 14299a50280..4dbc1776a61 100644 --- a/packages/datadog-plugin-express/test/index.spec.js +++ b/packages/datadog-plugin-express/test/index.spec.js @@ -65,6 +65,7 @@ describe('Plugin', () => { const app = express() app.use(() => { throw new Error('boom') }) + // eslint-disable-next-line n/handle-callback-err app.use((err, req, res, next) => { res.status(200).send() }) @@ -309,6 +310,7 @@ describe('Plugin', () => { next = _next }) app.use(() => { throw error }) + // eslint-disable-next-line n/handle-callback-err app.use((err, req, res, next) => next()) app.get('/user/:id', (req, res) => { res.status(200).send() @@ -1128,6 +1130,7 @@ describe('Plugin', () => { const error = new Error('boom') app.use((req, res, next) => next(error)) + // eslint-disable-next-line n/handle-callback-err app.use((error, req, res, next) => res.status(500).send()) getPort().then(port => { @@ -1164,6 +1167,7 @@ describe('Plugin', () => { const error = new Error('boom') app.use((req, res) => { throw error }) + // eslint-disable-next-line n/handle-callback-err app.use((error, req, res, next) => res.status(500).send()) getPort().then(port => { @@ -1611,6 +1615,7 @@ describe('Plugin', () => { const error = new Error('boom') app.use((req, res) => { throw error }) + // eslint-disable-next-line n/handle-callback-err app.use((error, req, res, next) => res.status(500).send()) getPort().then(port => { diff --git a/packages/datadog-plugin-express/test/integration-test/client.spec.js b/packages/datadog-plugin-express/test/integration-test/client.spec.js index ec250439766..a5c08d60ecb 100644 --- a/packages/datadog-plugin-express/test/integration-test/client.spec.js +++ b/packages/datadog-plugin-express/test/integration-test/client.spec.js @@ -17,7 +17,7 @@ describe('esm', () => { before(async function () { this.timeout(50000) sandbox = await createSandbox([`'express@${version}'`], false, - [`./packages/datadog-plugin-express/test/integration-test/*`]) + ['./packages/datadog-plugin-express/test/integration-test/*']) }) after(async function () { diff --git a/packages/datadog-plugin-express/test/leak.js b/packages/datadog-plugin-express/test/leak.js index cf52b1b19d6..3c8b97b4d1c 100644 --- a/packages/datadog-plugin-express/test/leak.js +++ b/packages/datadog-plugin-express/test/leak.js @@ -5,7 +5,7 @@ require('../../dd-trace') .use('express') const test = require('tape') -const express = require(`../../../versions/express`).get() +const express = require('../../../versions/express').get() const axios = require('axios') const getPort = require('get-port') const profile = require('../../dd-trace/test/profile') diff --git a/packages/datadog-plugin-fastify/test/index.spec.js b/packages/datadog-plugin-fastify/test/index.spec.js index 55701272606..920807fbd29 100644 --- a/packages/datadog-plugin-fastify/test/index.spec.js +++ b/packages/datadog-plugin-fastify/test/index.spec.js @@ -433,6 +433,7 @@ describe('Plugin', () => { it('should handle reply exceptions', done => { let error + // eslint-disable-next-line n/handle-callback-err app.setErrorHandler((error, request, reply) => { reply.statusCode = 500 reply.send() @@ -466,6 +467,7 @@ describe('Plugin', () => { }) it('should ignore reply exceptions if the request succeeds', done => { + // eslint-disable-next-line n/handle-callback-err app.setErrorHandler((error, request, reply) => { reply.statusCode = 200 reply.send() diff --git a/packages/datadog-plugin-fastify/test/integration-test/client.spec.js b/packages/datadog-plugin-fastify/test/integration-test/client.spec.js index 581f512305b..1ccb9791dc6 100644 --- a/packages/datadog-plugin-fastify/test/integration-test/client.spec.js +++ b/packages/datadog-plugin-fastify/test/integration-test/client.spec.js @@ -19,7 +19,7 @@ describe('esm', () => { before(async function () { this.timeout(20000) sandbox = await createSandbox([`'fastify@${version}'`], false, - [`./packages/datadog-plugin-fastify/test/integration-test/*`]) + ['./packages/datadog-plugin-fastify/test/integration-test/*']) }) after(async () => { diff --git a/packages/datadog-plugin-fetch/src/index.js b/packages/datadog-plugin-fetch/src/index.js index 240699ec3bb..ccad9b05ec1 100644 --- a/packages/datadog-plugin-fetch/src/index.js +++ b/packages/datadog-plugin-fetch/src/index.js @@ -4,7 +4,7 @@ const HttpClientPlugin = require('../../datadog-plugin-http/src/client') class FetchPlugin extends HttpClientPlugin { static get id () { return 'fetch' } - static get prefix () { return `apm:fetch:request` } + static get prefix () { return 'apm:fetch:request' } addTraceSub (eventName, handler) { this.addSub(`apm:${this.constructor.id}:${this.operation}:${eventName}`, handler) diff --git a/packages/datadog-plugin-fetch/test/index.spec.js b/packages/datadog-plugin-fetch/test/index.spec.js index 3ad82148b47..f7bd7b85889 100644 --- a/packages/datadog-plugin-fetch/test/index.spec.js +++ b/packages/datadog-plugin-fetch/test/index.spec.js @@ -227,7 +227,7 @@ describe('Plugin', () => { .catch(done) appListener = server(app, port, () => { - fetch(`http://localhost:${port}/user?foo=bar`, { headers: { 'foo': 'bar' } }) + fetch(`http://localhost:${port}/user?foo=bar`, { headers: { foo: 'bar' } }) }) }) }) @@ -619,7 +619,7 @@ describe('Plugin', () => { .use(traces => { const meta = traces[0][0].meta - expect(meta).to.have.property(`${HTTP_REQUEST_HEADERS}.x-baz`, `qux`) + expect(meta).to.have.property(`${HTTP_REQUEST_HEADERS}.x-baz`, 'qux') expect(meta).to.have.property(`${HTTP_RESPONSE_HEADERS}.x-foo`, 'bar') }) .then(done) diff --git a/packages/datadog-plugin-fetch/test/integration-test/client.spec.js b/packages/datadog-plugin-fetch/test/integration-test/client.spec.js index fe2560f3072..922c889134d 100644 --- a/packages/datadog-plugin-fetch/test/integration-test/client.spec.js +++ b/packages/datadog-plugin-fetch/test/integration-test/client.spec.js @@ -17,7 +17,7 @@ describe('esm', () => { before(async function () { this.timeout(50000) sandbox = await createSandbox(['get-port'], false, [ - `./packages/datadog-plugin-fetch/test/integration-test/*`]) + './packages/datadog-plugin-fetch/test/integration-test/*']) }) after(async function () { diff --git a/packages/datadog-plugin-fs/test/index.spec.js b/packages/datadog-plugin-fs/test/index.spec.js index da1310010c9..637333a9a02 100644 --- a/packages/datadog-plugin-fs/test/index.spec.js +++ b/packages/datadog-plugin-fs/test/index.spec.js @@ -76,12 +76,12 @@ describe('Plugin', () => { })) before(() => { tmpdir = realFS.mkdtempSync(path.join(os.tmpdir(), 'dd-trace-js-test')) - plugins['fs'] = require('../../datadog-plugin-fs/src') + plugins.fs = require('../../datadog-plugin-fs/src') channel('dd-trace:instrumentation:load').publish({ name: 'fs' }) }) after((done) => { rimraf(tmpdir, realFS, done) - delete plugins['fs'] + delete plugins.fs }) describe('without parent span', () => { @@ -177,6 +177,7 @@ describe('Plugin', () => { it('should handle errors', (done) => { const filename = path.join(__filename, Math.random().toString()) + // eslint-disable-next-line n/handle-callback-err fs.open(filename, 'r', (err) => { expectOneSpan(agent, done, { resource: 'open', @@ -230,6 +231,7 @@ describe('Plugin', () => { it('should handle errors', (done) => { const filename = path.join(__filename, Math.random().toString()) + // eslint-disable-next-line n/handle-callback-err fs.promises.open(filename, 'r').catch((err) => { expectOneSpan(agent, done, { resource: 'promises.open', @@ -807,7 +809,7 @@ describe('Plugin', () => { it('should be instrumented', (done) => { expectOneSpan(agent, done, { - resource: resource, + resource, meta: { 'file.descriptor': fd.toString(), 'file.mode': mode.toString(8) @@ -1348,11 +1350,14 @@ describe('Plugin', () => { 'file.path': __filename } }) - fs.exists(__filename, () => {}) // eslint-disable-line node/no-deprecated-api + // eslint-disable-next-line n/handle-callback-err + // eslint-disable-next-line n/no-deprecated-api + fs.exists(__filename, () => {}) }) it('should support promisification', () => { - const exists = util.promisify(fs.exists) // eslint-disable-line node/no-deprecated-api + // eslint-disable-next-line n/no-deprecated-api + const exists = util.promisify(fs.exists) return exists(__filename) }) @@ -1932,6 +1937,7 @@ function testHandleErrors (fs, name, tested, args, agent) { if (err) reject(err) else resolve() } + // eslint-disable-next-line n/handle-callback-err tested(fs, args, null, err => { expectOneSpan(agent, done, { resource: name, diff --git a/packages/datadog-plugin-google-cloud-pubsub/test/index.spec.js b/packages/datadog-plugin-google-cloud-pubsub/test/index.spec.js index 02f765aa877..2d570289ee6 100644 --- a/packages/datadog-plugin-google-cloud-pubsub/test/index.spec.js +++ b/packages/datadog-plugin-google-cloud-pubsub/test/index.spec.js @@ -39,7 +39,7 @@ describe('Plugin', () => { }) beforeEach(() => { tracer = require('../../dd-trace') - gax = require(`../../../versions/google-gax@3.5.7`).get() + gax = require('../../../versions/google-gax@3.5.7').get() const lib = require(`../../../versions/@google-cloud/pubsub@${version}`).get() project = getProjectId() topicName = getTopic() @@ -60,7 +60,7 @@ describe('Plugin', () => { meta: { 'pubsub.method': 'createTopic', 'span.kind': 'client', - 'component': 'google-cloud-pubsub' + component: 'google-cloud-pubsub' } }) await pubsub.createTopic(topicName) @@ -82,7 +82,7 @@ describe('Plugin', () => { meta: { 'pubsub.method': 'createTopic', 'span.kind': 'client', - 'component': 'google-cloud-pubsub' + component: 'google-cloud-pubsub' } }) const name = `projects/${project}/topics/${topicName}` @@ -99,7 +99,7 @@ describe('Plugin', () => { error: 1, meta: { 'pubsub.method': 'createTopic', - 'component': 'google-cloud-pubsub' + component: 'google-cloud-pubsub' } }) const publisher = new v1.PublisherClient({ projectId: project }) @@ -130,7 +130,7 @@ describe('Plugin', () => { 'pubsub.topic': resource, 'pubsub.method': 'publish', 'span.kind': 'producer', - 'component': 'google-cloud-pubsub' + component: 'google-cloud-pubsub' } }) const [topic] = await pubsub.createTopic(topicName) @@ -165,7 +165,7 @@ describe('Plugin', () => { service: expectedSchema.receive.serviceName, type: 'worker', meta: { - 'component': 'google-cloud-pubsub', + component: 'google-cloud-pubsub', 'span.kind': 'consumer', 'pubsub.topic': resource }, @@ -215,7 +215,7 @@ describe('Plugin', () => { [ERROR_MESSAGE]: error.message, [ERROR_TYPE]: error.name, [ERROR_STACK]: error.stack, - 'component': 'google-cloud-pubsub' + component: 'google-cloud-pubsub' } }) const [topic] = await pubsub.createTopic(topicName) @@ -327,7 +327,7 @@ describe('Plugin', () => { service, error: 0, meta: { - 'component': 'google-cloud-pubsub', + component: 'google-cloud-pubsub', 'gcloud.project_id': project } }, expected) diff --git a/packages/datadog-plugin-google-cloud-pubsub/test/integration-test/client.spec.js b/packages/datadog-plugin-google-cloud-pubsub/test/integration-test/client.spec.js index 6619bcfe997..0effff0795b 100644 --- a/packages/datadog-plugin-google-cloud-pubsub/test/integration-test/client.spec.js +++ b/packages/datadog-plugin-google-cloud-pubsub/test/integration-test/client.spec.js @@ -16,8 +16,8 @@ describe('esm', () => { withVersions('google-cloud-pubsub', '@google-cloud/pubsub', '>=4.0.0', version => { before(async function () { this.timeout(20000) - sandbox = await createSandbox([`'@google-cloud/pubsub@${version}'`], false, [ './packages/dd-trace/src/id.js', - `./packages/datadog-plugin-google-cloud-pubsub/test/integration-test/*`]) + sandbox = await createSandbox([`'@google-cloud/pubsub@${version}'`], false, ['./packages/dd-trace/src/id.js', + './packages/datadog-plugin-google-cloud-pubsub/test/integration-test/*']) }) after(async () => { diff --git a/packages/datadog-plugin-google-cloud-pubsub/test/naming.js b/packages/datadog-plugin-google-cloud-pubsub/test/naming.js index 97f7f490617..da2ffd55247 100644 --- a/packages/datadog-plugin-google-cloud-pubsub/test/naming.js +++ b/packages/datadog-plugin-google-cloud-pubsub/test/naming.js @@ -34,6 +34,6 @@ const rawExpectedSchema = { } module.exports = { - rawExpectedSchema: rawExpectedSchema, + rawExpectedSchema, expectedSchema: resolveNaming(rawExpectedSchema) } diff --git a/packages/datadog-plugin-graphql/src/resolve.js b/packages/datadog-plugin-graphql/src/resolve.js index c8d768b0c4e..234e53d740d 100644 --- a/packages/datadog-plugin-graphql/src/resolve.js +++ b/packages/datadog-plugin-graphql/src/resolve.js @@ -126,7 +126,7 @@ function getResolverInfo (info, args) { if (Array.isArray(directives)) { for (const directive of directives) { const argList = {} - for (const argument of directive['arguments']) { + for (const argument of directive.arguments) { argList[argument.name.value] = argument.value.value } diff --git a/packages/datadog-plugin-graphql/test/index.spec.js b/packages/datadog-plugin-graphql/test/index.spec.js index 7722073bc70..0eb87f6c32e 100644 --- a/packages/datadog-plugin-graphql/test/index.spec.js +++ b/packages/datadog-plugin-graphql/test/index.spec.js @@ -112,7 +112,7 @@ describe('Plugin', () => { friends: { type: new graphql.GraphQLList(Human), resolve () { - return [ { name: 'alice' }, { name: 'bob' } ] + return [{ name: 'alice' }, { name: 'bob' }] } } } @@ -259,7 +259,7 @@ describe('Plugin', () => { withNamingSchema( () => { - const source = `query MyQuery { hello(name: "world") }` + const source = 'query MyQuery { hello(name: "world") }' const variableValues = { who: 'world' } graphql.graphql({ schema, source, variableValues }) }, @@ -273,7 +273,7 @@ describe('Plugin', () => { ) it('should instrument parsing', done => { - const source = `query MyQuery { hello(name: "world") }` + const source = 'query MyQuery { hello(name: "world") }' const variableValues = { who: 'world' } agent @@ -295,7 +295,7 @@ describe('Plugin', () => { }) it('should instrument validation', done => { - const source = `query MyQuery { hello(name: "world") }` + const source = 'query MyQuery { hello(name: "world") }' const variableValues = { who: 'world' } agent @@ -317,7 +317,7 @@ describe('Plugin', () => { }) it('should instrument execution', done => { - const source = `query MyQuery { hello(name: "world") }` + const source = 'query MyQuery { hello(name: "world") }' const variableValues = { who: 'world' } agent @@ -340,7 +340,7 @@ describe('Plugin', () => { }) it('should not include variables by default', done => { - const source = `query MyQuery($who: String!) { hello(name: $who) }` + const source = 'query MyQuery($who: String!) { hello(name: $who) }' const variableValues = { who: 'world' } agent @@ -355,7 +355,7 @@ describe('Plugin', () => { }) it('should instrument schema resolvers', done => { - const source = `{ hello(name: "world") }` + const source = '{ hello(name: "world") }' agent .use(traces => { @@ -495,7 +495,7 @@ describe('Plugin', () => { }) it('should instrument mutations', done => { - const source = `mutation { human { name } }` + const source = 'mutation { human { name } }' agent .use(traces => { @@ -510,7 +510,7 @@ describe('Plugin', () => { }) it('should instrument subscriptions', done => { - const source = `subscription { human { name } }` + const source = 'subscription { human { name } }' agent .use(traces => { @@ -525,7 +525,7 @@ describe('Plugin', () => { }) it('should handle a circular schema', done => { - const source = `{ human { pets { owner { name } } } }` + const source = '{ human { pets { owner { name } } } }' graphql.graphql({ schema, source }) .then((result) => { @@ -542,7 +542,7 @@ describe('Plugin', () => { } `) - const source = `{ hello }` + const source = '{ hello }' const rootValue = { hello: 'world' } agent @@ -566,7 +566,7 @@ describe('Plugin', () => { } `) - const source = `{ hello }` + const source = '{ hello }' const rootValue = { hello: 'world' } @@ -589,7 +589,7 @@ describe('Plugin', () => { }) it('should not instrument schema resolvers multiple times', done => { - const source = `{ hello(name: "world") }` + const source = '{ hello(name: "world") }' agent.use(() => { // skip first call agent @@ -608,7 +608,7 @@ describe('Plugin', () => { }) it('should run parsing, validation and execution in the current context', done => { - const source = `query MyQuery { hello(name: "world") }` + const source = 'query MyQuery { hello(name: "world") }' const variableValues = { who: 'world' } const span = tracer.startSpan('test.request') @@ -651,7 +651,7 @@ describe('Plugin', () => { } `) - const source = `{ hello }` + const source = '{ hello }' const rootValue = { hello () { @@ -674,7 +674,7 @@ describe('Plugin', () => { } `) - const source = `{ hello }` + const source = '{ hello }' const rootValue = { hello () { @@ -694,8 +694,8 @@ describe('Plugin', () => { }) it('should handle unsupported operations', () => { - const source = `query MyQuery { hello(name: "world") }` - const subscription = `subscription { human { name } }` + const source = 'query MyQuery { hello(name: "world") }' + const subscription = 'subscription { human { name } }' return graphql.graphql({ schema, source }) .then(() => graphql.graphql({ schema, source: subscription })) @@ -705,7 +705,7 @@ describe('Plugin', () => { }) it('should handle calling low level APIs directly', done => { - const source = `query MyQuery { hello(name: "world") }` + const source = 'query MyQuery { hello(name: "world") }' Promise .all([ @@ -733,7 +733,7 @@ describe('Plugin', () => { }) it('should handle Source objects', done => { - const source = `query MyQuery { hello(name: "world") }` + const source = 'query MyQuery { hello(name: "world") }' const document = graphql.parse(new graphql.Source(source)) agent @@ -806,7 +806,7 @@ describe('Plugin', () => { }) it('should handle validation errors', done => { - const source = `{ human { address } }` + const source = '{ human { address } }' const document = graphql.parse(source) agent @@ -829,7 +829,7 @@ describe('Plugin', () => { }) it('should handle execution exceptions', done => { - const source = `{ hello }` + const source = '{ hello }' const document = graphql.parse(source) let error @@ -858,7 +858,7 @@ describe('Plugin', () => { }) it('should handle execution errors', done => { - const source = `{ hello }` + const source = '{ hello }' const document = graphql.parse(source) const schema = graphql.buildSchema(` @@ -906,7 +906,7 @@ describe('Plugin', () => { } `) - const source = `{ hello }` + const source = '{ hello }' const rootValue = { hello: () => { @@ -940,7 +940,7 @@ describe('Plugin', () => { } `) - const source = `{ hello }` + const source = '{ hello }' const rootValue = { hello: () => { @@ -972,7 +972,7 @@ describe('Plugin', () => { } `) - const source = `{ hello }` + const source = '{ hello }' const rootValue = { hello: () => 'world' @@ -987,7 +987,7 @@ describe('Plugin', () => { }) it('should support multiple executions on a pre-parsed document', () => { - const source = `query MyQuery { hello(name: "world") }` + const source = 'query MyQuery { hello(name: "world") }' const document = graphql.parse(source) expect(() => { graphql.execute({ schema, document }) @@ -997,7 +997,7 @@ describe('Plugin', () => { it('should not fail without directives in the document ' + 'and with subscription to datadog:graphql:resolver:start', () => { - const source = `query MyQuery { hello(name: "world") }` + const source = 'query MyQuery { hello(name: "world") }' const document = graphql.parse(source) delete document.definitions[0].directives delete document.definitions[0].selectionSet.selections[0].directives @@ -1015,7 +1015,7 @@ describe('Plugin', () => { }) it('should support multiple validations on a pre-parsed document', () => { - const source = `query MyQuery { hello(name: "world") }` + const source = 'query MyQuery { hello(name: "world") }' const document = graphql.parse(source) expect(() => { @@ -1111,7 +1111,7 @@ describe('Plugin', () => { // https://github.com/graphql/graphql-js/pull/2904 if (!semver.intersects(version, '>=16')) { it('should instrument using positional arguments', done => { - const source = `query MyQuery { hello(name: "world") }` + const source = 'query MyQuery { hello(name: "world") }' const variableValues = { who: 'world' } agent @@ -1134,7 +1134,7 @@ describe('Plugin', () => { }) } else { it('should not support positional arguments', done => { - const source = `query MyQuery { hello(name: "world") }` + const source = 'query MyQuery { hello(name: "world") }' const variableValues = { who: 'world' } graphql.graphql(schema, source, null, null, variableValues) @@ -1201,7 +1201,7 @@ describe('Plugin', () => { }) it('should be configured with the correct values', done => { - const source = `{ hello(name: "world") }` + const source = '{ hello(name: "world") }' agent .use(traces => { @@ -1334,7 +1334,7 @@ describe('Plugin', () => { } `) - const source = `{ hello }` + const source = '{ hello }' const rootValue = { hello () { @@ -1423,7 +1423,7 @@ describe('Plugin', () => { }) it('should not collapse list field resolvers', done => { - const source = `{ friends { name } }` + const source = '{ friends { name } }' agent .use(traces => { @@ -1477,7 +1477,7 @@ describe('Plugin', () => { }) it('should fallback to the operation type and name', done => { - const source = `query WithoutSignature { friends { name } }` + const source = 'query WithoutSignature { friends { name } }' agent .use(traces => { @@ -1655,7 +1655,7 @@ describe('Plugin', () => { graphql = require(`../../../versions/graphql@${version}`).get() const apolloCore = require(`../../../versions/apollo-server-core@${apolloVersion}`).get() - const graphqlTools = require(`../../../versions/graphql-tools@3.1.1`).get() + const graphqlTools = require('../../../versions/graphql-tools@3.1.1').get() runQuery = apolloCore.runQuery mergeSchemas = graphqlTools.mergeSchemas diff --git a/packages/datadog-plugin-graphql/test/integration-test/client.spec.js b/packages/datadog-plugin-graphql/test/integration-test/client.spec.js index 0deed5fbc17..d0a4b0e42d3 100644 --- a/packages/datadog-plugin-graphql/test/integration-test/client.spec.js +++ b/packages/datadog-plugin-graphql/test/integration-test/client.spec.js @@ -17,7 +17,7 @@ describe('esm', () => { before(async function () { this.timeout(50000) sandbox = await createSandbox([`'graphql@${version}'`], false, [ - `./packages/datadog-plugin-graphql/test/integration-test/*`]) + './packages/datadog-plugin-graphql/test/integration-test/*']) }) after(async function () { diff --git a/packages/datadog-plugin-graphql/test/leak.js b/packages/datadog-plugin-graphql/test/leak.js index d03a4384038..d6b1c5952b6 100644 --- a/packages/datadog-plugin-graphql/test/leak.js +++ b/packages/datadog-plugin-graphql/test/leak.js @@ -5,7 +5,7 @@ require('../../dd-trace') .use('graphql') const test = require('tape') -const graphql = require(`../../../versions/graphql`).get() +const graphql = require('../../../versions/graphql').get() const profile = require('../../dd-trace/test/profile') test('graphql plugin should not leak', t => { @@ -15,7 +15,7 @@ test('graphql plugin should not leak', t => { } `) - const source = `{ hello }` + const source = '{ hello }' profile(t, operation, 2000) diff --git a/packages/datadog-plugin-grpc/src/client.js b/packages/datadog-plugin-grpc/src/client.js index 0d008cc0070..ad841aab197 100644 --- a/packages/datadog-plugin-grpc/src/client.js +++ b/packages/datadog-plugin-grpc/src/client.js @@ -8,7 +8,7 @@ const { addMetadataTags, getFilter, getMethodMetadata } = require('./util') class GrpcClientPlugin extends ClientPlugin { static get id () { return 'grpc' } static get operation () { return 'client:request' } - static get prefix () { return `apm:grpc:client:request` } + static get prefix () { return 'apm:grpc:client:request' } static get peerServicePrecursors () { return ['rpc.service'] } constructor (...args) { @@ -30,7 +30,7 @@ class GrpcClientPlugin extends ClientPlugin { kind: 'client', type: 'http', meta: { - 'component': 'grpc', + component: 'grpc', 'grpc.method.kind': method.kind, 'grpc.method.path': method.path, 'grpc.method.name': method.name, diff --git a/packages/datadog-plugin-grpc/src/server.js b/packages/datadog-plugin-grpc/src/server.js index 42e00f1dafd..d63164e31c1 100644 --- a/packages/datadog-plugin-grpc/src/server.js +++ b/packages/datadog-plugin-grpc/src/server.js @@ -8,7 +8,7 @@ const { addMetadataTags, getFilter, getMethodMetadata } = require('./util') class GrpcServerPlugin extends ServerPlugin { static get id () { return 'grpc' } static get operation () { return 'server:request' } - static get prefix () { return `apm:grpc:server:request` } + static get prefix () { return 'apm:grpc:server:request' } constructor (...args) { super(...args) @@ -39,7 +39,7 @@ class GrpcServerPlugin extends ServerPlugin { kind: 'server', type: 'web', meta: { - 'component': 'grpc', + component: 'grpc', 'grpc.method.kind': method.kind, 'grpc.method.path': method.path, 'grpc.method.name': method.name, diff --git a/packages/datadog-plugin-grpc/test/client.spec.js b/packages/datadog-plugin-grpc/test/client.spec.js index e28685fe19c..38205f1db38 100644 --- a/packages/datadog-plugin-grpc/test/client.spec.js +++ b/packages/datadog-plugin-grpc/test/client.spec.js @@ -1,5 +1,6 @@ 'use strict' +const path = require('path') const agent = require('../../dd-trace/test/plugins/agent') const getPort = require('get-port') const semver = require('semver') @@ -56,7 +57,7 @@ describe('Plugin', () => { } function buildProtoClient (service, ClientService) { - const definition = loader.loadSync(`${__dirname}/test.proto`) + const definition = loader.loadSync(path.join(__dirname, 'test.proto')) const TestService = grpc.loadPackageDefinition(definition).test.TestService return buildGenericService(service, TestService, ClientService) @@ -141,7 +142,7 @@ describe('Plugin', () => { 'network.destination.port': port.toString(), 'rpc.service': 'test.TestService', 'span.kind': 'client', - 'component': 'grpc' + component: 'grpc' }) }) }) @@ -170,7 +171,7 @@ describe('Plugin', () => { 'grpc.method.kind': 'unary', 'rpc.service': 'test.TestService', 'span.kind': 'client', - 'component': 'grpc' + component: 'grpc' }) expect(traces[0][0].metrics).to.include({ @@ -207,7 +208,7 @@ describe('Plugin', () => { 'grpc.method.kind': 'server_streaming', 'rpc.service': 'test.TestService', 'span.kind': 'client', - 'component': 'grpc' + component: 'grpc' }) expect(traces[0][0].metrics).to.include({ @@ -242,7 +243,7 @@ describe('Plugin', () => { 'grpc.method.kind': 'client_streaming', 'rpc.service': 'test.TestService', 'span.kind': 'client', - 'component': 'grpc' + component: 'grpc' }) expect(traces[0][0].metrics).to.include({ @@ -345,7 +346,7 @@ describe('Plugin', () => { 'grpc.method.kind': 'unary', 'rpc.service': 'test.TestService', 'span.kind': 'client', - 'component': 'grpc' + component: 'grpc' }) expect(traces[0][0].meta).to.have.property(ERROR_STACK) expect(traces[0][0].metrics).to.have.property('grpc.status.code', 2) @@ -353,7 +354,7 @@ describe('Plugin', () => { }) it('should handle protocol errors', async () => { - const definition = loader.loadSync(`${__dirname}/invalid.proto`) + const definition = loader.loadSync(path.join(__dirname, 'invalid.proto')) const test = grpc.loadPackageDefinition(definition).test const client = await buildClient({ getUnary: (_, callback) => callback(null) @@ -373,7 +374,7 @@ describe('Plugin', () => { 'grpc.method.kind': 'unary', 'rpc.service': 'test.TestService', 'span.kind': 'client', - 'component': 'grpc' + component: 'grpc' }) expect(traces[0][0].meta).to.have.property(ERROR_STACK) expect(traces[0][0].meta[ERROR_MESSAGE]).to.match(/^13 INTERNAL:.+$/m) @@ -382,7 +383,7 @@ describe('Plugin', () => { }) it('should handle property named "service"', async () => { - const definition = loader.loadSync(`${__dirname}/hasservice.proto`) + const definition = loader.loadSync(path.join(__dirname, 'hasservice.proto')) const thing = grpc.loadPackageDefinition(definition).thing await buildClient({ getUnary: (_, callback) => callback(null) @@ -412,7 +413,7 @@ describe('Plugin', () => { 'rpc.service': 'test.TestService', 'grpc.method.kind': 'unary', 'span.kind': 'client', - 'component': 'grpc' + component: 'grpc' }) expect(traces[0][0].metrics).to.deep.include({ @@ -444,7 +445,7 @@ describe('Plugin', () => { 'grpc.method.kind': 'unary', 'rpc.service': 'test.TestService', 'span.kind': 'client', - 'component': 'grpc' + component: 'grpc' }) expect(traces[0][0].metrics).to.deep.include({ diff --git a/packages/datadog-plugin-grpc/test/integration-test/client.spec.js b/packages/datadog-plugin-grpc/test/integration-test/client.spec.js index 5b6b864d2ff..c9a31f5c65e 100644 --- a/packages/datadog-plugin-grpc/test/integration-test/client.spec.js +++ b/packages/datadog-plugin-grpc/test/integration-test/client.spec.js @@ -17,7 +17,7 @@ describe('esm', () => { before(async function () { this.timeout(20000) sandbox = await createSandbox([`'@grpc/grpc-js@${version}'`, '@grpc/proto-loader', 'get-port@^3.2.0'], false, [ - `./packages/datadog-plugin-grpc/test/*`]) + './packages/datadog-plugin-grpc/test/*']) }) after(async () => { diff --git a/packages/datadog-plugin-grpc/test/naming.js b/packages/datadog-plugin-grpc/test/naming.js index 25e6706e10a..f84571b78e5 100644 --- a/packages/datadog-plugin-grpc/test/naming.js +++ b/packages/datadog-plugin-grpc/test/naming.js @@ -25,6 +25,6 @@ const rawExpectedSchema = { } module.exports = { - rawExpectedSchema: rawExpectedSchema, + rawExpectedSchema, expectedSchema: resolveNaming(rawExpectedSchema) } diff --git a/packages/datadog-plugin-grpc/test/server.spec.js b/packages/datadog-plugin-grpc/test/server.spec.js index a049bbfc4cb..2406d087884 100644 --- a/packages/datadog-plugin-grpc/test/server.spec.js +++ b/packages/datadog-plugin-grpc/test/server.spec.js @@ -1,5 +1,6 @@ 'use strict' +const path = require('path') const agent = require('../../dd-trace/test/plugins/agent') const getPort = require('get-port') const Readable = require('stream').Readable @@ -27,7 +28,7 @@ describe('Plugin', () => { }, service) const loader = require('../../../versions/@grpc/proto-loader').get() - const definition = loader.loadSync(`${__dirname}/test.proto`) + const definition = loader.loadSync(path.join(__dirname, 'test.proto')) const TestService = grpc.loadPackageDefinition(definition).test.TestService server = new grpc.Server() diff --git a/packages/datadog-plugin-hapi/test/integration-test/client.spec.js b/packages/datadog-plugin-hapi/test/integration-test/client.spec.js index e483b593fe5..3105f810458 100644 --- a/packages/datadog-plugin-hapi/test/integration-test/client.spec.js +++ b/packages/datadog-plugin-hapi/test/integration-test/client.spec.js @@ -18,7 +18,7 @@ describe('esm', () => { before(async function () { this.timeout(20000) sandbox = await createSandbox([`'@hapi/hapi@${version}'`], false, [ - `./packages/datadog-plugin-hapi/test/integration-test/*`]) + './packages/datadog-plugin-hapi/test/integration-test/*']) }) after(async () => { diff --git a/packages/datadog-plugin-http/src/client.js b/packages/datadog-plugin-http/src/client.js index 5d48f3331e9..d4c105d2508 100644 --- a/packages/datadog-plugin-http/src/client.js +++ b/packages/datadog-plugin-http/src/client.js @@ -17,7 +17,7 @@ const HTTP_RESPONSE_HEADERS = tags.HTTP_RESPONSE_HEADERS class HttpClientPlugin extends ClientPlugin { static get id () { return 'http' } - static get prefix () { return `apm:http:client:request` } + static get prefix () { return 'apm:http:client:request' } bindStart (message) { const { args, http = {} } = message @@ -227,7 +227,7 @@ function hasAmazonSignature (options) { return true } - if ([].concat(headers['authorization']).some(startsWith('AWS4-HMAC-SHA256'))) { + if ([].concat(headers.authorization).some(startsWith('AWS4-HMAC-SHA256'))) { return true } } diff --git a/packages/datadog-plugin-http/test/client.spec.js b/packages/datadog-plugin-http/test/client.spec.js index 5a48959892e..22406986b15 100644 --- a/packages/datadog-plugin-http/test/client.spec.js +++ b/packages/datadog-plugin-http/test/client.spec.js @@ -125,7 +125,7 @@ describe('Plugin', () => { }) }) - it(`should also support get()`, done => { + it('should also support get()', done => { const app = express() app.get('/user', (req, res) => { @@ -231,8 +231,8 @@ describe('Plugin', () => { hostname: 'localhost', path: '/user', headers: { - 'Connection': 'Upgrade', - 'Upgrade': 'websocket' + Connection: 'Upgrade', + Upgrade: 'websocket' } }) @@ -1357,9 +1357,9 @@ describe('Plugin', () => { const meta = traces[0][0].meta expect(meta).to.have.property(`${HTTP_REQUEST_HEADERS}.host`, `localhost:${port}`) - expect(meta).to.have.property(`http.baz`, 'baz') + expect(meta).to.have.property('http.baz', 'baz') expect(meta).to.have.property(`${HTTP_RESPONSE_HEADERS}.x-foo`, 'foo') - expect(meta).to.have.property(`http.bar`, 'bar') + expect(meta).to.have.property('http.bar', 'bar') }) .then(done) .catch(done) @@ -1388,7 +1388,7 @@ describe('Plugin', () => { .use(traces => { const meta = traces[0][0].meta - expect(meta).to.have.property(`${HTTP_REQUEST_HEADERS}.x-foo`, `bar`) + expect(meta).to.have.property(`${HTTP_REQUEST_HEADERS}.x-foo`, 'bar') }) .then(done) .catch(done) @@ -1416,7 +1416,7 @@ describe('Plugin', () => { .use(traces => { const meta = traces[0][0].meta - expect(meta).to.have.property(`${HTTP_REQUEST_HEADERS}.x-foo`, `bar1,bar2`) + expect(meta).to.have.property(`${HTTP_REQUEST_HEADERS}.x-foo`, 'bar1,bar2') }) .then(done) .catch(done) diff --git a/packages/datadog-plugin-http/test/integration-test/client.spec.js b/packages/datadog-plugin-http/test/integration-test/client.spec.js index 4b5637ae98c..2d11c13168b 100644 --- a/packages/datadog-plugin-http/test/integration-test/client.spec.js +++ b/packages/datadog-plugin-http/test/integration-test/client.spec.js @@ -16,7 +16,7 @@ describe('esm', () => { before(async function () { this.timeout(20000) sandbox = await createSandbox([], false, [ - `./packages/datadog-plugin-http/test/integration-test/*`]) + './packages/datadog-plugin-http/test/integration-test/*']) }) after(async () => { diff --git a/packages/datadog-plugin-http/test/server.spec.js b/packages/datadog-plugin-http/test/server.spec.js index 4f6f5a15ed3..ba9873427fb 100644 --- a/packages/datadog-plugin-http/test/server.spec.js +++ b/packages/datadog-plugin-http/test/server.spec.js @@ -145,7 +145,7 @@ describe('Plugin', () => { axios.get(`http://localhost:${port}/user`).catch(done) }) - it(`should run the request's close event in the correct context`, done => { + it('should run the request\'s close event in the correct context', done => { app = (req, res) => { req.on('close', () => { expect(tracer.scope().active()).to.equal(null) @@ -156,7 +156,7 @@ describe('Plugin', () => { axios.get(`http://localhost:${port}/user`).catch(done) }) - it(`should run the response's close event in the correct context`, done => { + it('should run the response\'s close event in the correct context', done => { app = (req, res) => { const span = tracer.scope().active() @@ -169,7 +169,7 @@ describe('Plugin', () => { axios.get(`http://localhost:${port}/user`).catch(done) }) - it(`should run the finish event in the correct context`, done => { + it('should run the finish event in the correct context', done => { app = (req, res) => { const span = tracer.scope().active() diff --git a/packages/datadog-plugin-http2/src/client.js b/packages/datadog-plugin-http2/src/client.js index 4a60ee0b4db..296f1161e59 100644 --- a/packages/datadog-plugin-http2/src/client.js +++ b/packages/datadog-plugin-http2/src/client.js @@ -25,7 +25,7 @@ const HTTP2_METHOD_GET = 'GET' class Http2ClientPlugin extends ClientPlugin { static get id () { return 'http2' } - static get prefix () { return `apm:http2:client:request` } + static get prefix () { return 'apm:http2:client:request' } bindStart (message) { const { authority, options, headers = {} } = message @@ -122,7 +122,8 @@ function extractSessionDetails (authority, options) { const protocol = authority.protocol || options.protocol || 'https:' let port = '' + (authority.port !== '' - ? authority.port : (authority.protocol === 'http:' ? 80 : 443)) + ? authority.port + : (authority.protocol === 'http:' ? 80 : 443)) let host = authority.hostname || authority.host || 'localhost' if (protocol === 'https:' && options) { @@ -144,7 +145,7 @@ function hasAmazonSignature (headers, path) { return true } - if ([].concat(headers['authorization']).some(startsWith('AWS4-HMAC-SHA256'))) { + if ([].concat(headers.authorization).some(startsWith('AWS4-HMAC-SHA256'))) { return true } } diff --git a/packages/datadog-plugin-http2/test/client.spec.js b/packages/datadog-plugin-http2/test/client.spec.js index 7877be9c427..970569c12a5 100644 --- a/packages/datadog-plugin-http2/test/client.spec.js +++ b/packages/datadog-plugin-http2/test/client.spec.js @@ -563,6 +563,7 @@ describe('Plugin', () => { .catch(done) const client = http2.connect(`${protocol}://localhost:${port}`) + // eslint-disable-next-line n/handle-callback-err .on('error', (err) => {}) const req = client.request({ ':path': '/user' }) @@ -660,7 +661,7 @@ describe('Plugin', () => { .on('error', done) .end() - client.request({ ':path': `/user?test=2` }) + client.request({ ':path': '/user?test=2' }) .on('error', done) .end() diff --git a/packages/datadog-plugin-http2/test/integration-test/client.spec.js b/packages/datadog-plugin-http2/test/integration-test/client.spec.js index 368841dc112..09ff12dedcc 100644 --- a/packages/datadog-plugin-http2/test/integration-test/client.spec.js +++ b/packages/datadog-plugin-http2/test/integration-test/client.spec.js @@ -16,7 +16,7 @@ describe('esm', () => { before(async function () { this.timeout(50000) sandbox = await createSandbox(['http2'], false, [ - `./packages/datadog-plugin-http2/test/integration-test/*`]) + './packages/datadog-plugin-http2/test/integration-test/*']) }) after(async function () { diff --git a/packages/datadog-plugin-http2/test/server.spec.js b/packages/datadog-plugin-http2/test/server.spec.js index 2c2be7175bb..c412c9ccbea 100644 --- a/packages/datadog-plugin-http2/test/server.spec.js +++ b/packages/datadog-plugin-http2/test/server.spec.js @@ -9,6 +9,7 @@ class MockAbortController { constructor () { this.signal = new EventEmitter() } + abort () { this.signal.emit('abort') } @@ -167,7 +168,7 @@ describe('Plugin', () => { request(http2, `http://localhost:${port}/user`).catch(done) }) - it(`should run the request's close event in the correct context`, done => { + it('should run the request\'s close event in the correct context', done => { app = (req, res) => { req.on('close', () => { expect(tracer.scope().active()).to.equal(null) @@ -178,7 +179,7 @@ describe('Plugin', () => { request(http2, `http://localhost:${port}/user`).catch(done) }) - it(`should run the response's close event in the correct context`, done => { + it('should run the response\'s close event in the correct context', done => { app = (req, res) => { const span = tracer.scope().active() @@ -191,7 +192,7 @@ describe('Plugin', () => { request(http2, `http://localhost:${port}/user`).catch(done) }) - it(`should run the finish event in the correct context`, done => { + it('should run the finish event in the correct context', done => { app = (req, res) => { const span = tracer.scope().active() diff --git a/packages/datadog-plugin-ioredis/test/integration-test/client.spec.js b/packages/datadog-plugin-ioredis/test/integration-test/client.spec.js index 27859befd1d..a328b846952 100644 --- a/packages/datadog-plugin-ioredis/test/integration-test/client.spec.js +++ b/packages/datadog-plugin-ioredis/test/integration-test/client.spec.js @@ -16,7 +16,7 @@ describe('esm', () => { before(async function () { this.timeout(20000) sandbox = await createSandbox([`'ioredis@${version}'`], false, [ - `./packages/datadog-plugin-ioredis/test/integration-test/*`]) + './packages/datadog-plugin-ioredis/test/integration-test/*']) }) after(async () => { diff --git a/packages/datadog-plugin-ioredis/test/naming.js b/packages/datadog-plugin-ioredis/test/naming.js index 2df9f5056d8..1ed3f17e428 100644 --- a/packages/datadog-plugin-ioredis/test/naming.js +++ b/packages/datadog-plugin-ioredis/test/naming.js @@ -14,6 +14,6 @@ const rawExpectedSchema = { } module.exports = { - rawExpectedSchema: rawExpectedSchema, + rawExpectedSchema, expectedSchema: resolveNaming(rawExpectedSchema) } diff --git a/packages/datadog-plugin-jest/src/index.js b/packages/datadog-plugin-jest/src/index.js index df5c940f60e..fcfe2cd30d2 100644 --- a/packages/datadog-plugin-jest/src/index.js +++ b/packages/datadog-plugin-jest/src/index.js @@ -51,6 +51,7 @@ class JestPlugin extends CiPlugin { } return this.unskippableSuites } + getForcedToRunSuites (forcedToRunSuitesList) { if (!this.forcedToRunSuites) { this.forcedToRunSuites = JSON.parse(forcedToRunSuitesList) diff --git a/packages/datadog-plugin-jest/test/util.spec.js b/packages/datadog-plugin-jest/test/util.spec.js index d79886c6163..080e943e183 100644 --- a/packages/datadog-plugin-jest/test/util.spec.js +++ b/packages/datadog-plugin-jest/test/util.spec.js @@ -168,9 +168,9 @@ describe('getJestSuitesToRun', () => { const rootDir = __dirname getJestSuitesToRun(skippableSuites, tests, rootDir) - expect(globalConfig.testEnvironmentOptions['_ddUnskippable']) + expect(globalConfig.testEnvironmentOptions._ddUnskippable) .to.eql(JSON.stringify({ 'fixtures/test-unskippable.js': true })) - expect(globalConfig.testEnvironmentOptions['_ddForcedToRun']) + expect(globalConfig.testEnvironmentOptions._ddForcedToRun) .to.eql(JSON.stringify({ 'fixtures/test-unskippable.js': true })) }) }) diff --git a/packages/datadog-plugin-kafkajs/src/consumer.js b/packages/datadog-plugin-kafkajs/src/consumer.js index 69cb34f642b..420fea10902 100644 --- a/packages/datadog-plugin-kafkajs/src/consumer.js +++ b/packages/datadog-plugin-kafkajs/src/consumer.js @@ -70,7 +70,7 @@ class KafkajsConsumerPlugin extends ConsumerPlugin { resource: topic, type: 'worker', meta: { - 'component': 'kafkajs', + component: 'kafkajs', 'kafka.topic': topic, 'kafka.message.offset': message.offset }, diff --git a/packages/datadog-plugin-kafkajs/src/producer.js b/packages/datadog-plugin-kafkajs/src/producer.js index 83c322a1366..2a8054d7974 100644 --- a/packages/datadog-plugin-kafkajs/src/producer.js +++ b/packages/datadog-plugin-kafkajs/src/producer.js @@ -70,7 +70,7 @@ class KafkajsProducerPlugin extends ProducerPlugin { const span = this.startSpan({ resource: topic, meta: { - 'component': 'kafkajs', + component: 'kafkajs', 'kafka.topic': topic }, metrics: { diff --git a/packages/datadog-plugin-kafkajs/test/index.spec.js b/packages/datadog-plugin-kafkajs/test/index.spec.js index c7927c04ba2..2ea130456ba 100644 --- a/packages/datadog-plugin-kafkajs/test/index.spec.js +++ b/packages/datadog-plugin-kafkajs/test/index.spec.js @@ -39,7 +39,7 @@ describe('Plugin', () => { describe('without configuration', () => { const messages = [{ key: 'key1', value: 'test2' }] beforeEach(async () => { - process.env['DD_DATA_STREAMS_ENABLED'] = 'true' + process.env.DD_DATA_STREAMS_ENABLED = 'true' tracer = require('../../dd-trace') await agent.load('kafkajs') const lib = require(`../../../versions/kafkajs@${version}`).get() @@ -57,7 +57,7 @@ describe('Plugin', () => { service: expectedSchema.send.serviceName, meta: { 'span.kind': 'producer', - 'component': 'kafkajs', + component: 'kafkajs', 'pathway.hash': expectedProducerHash.readBigUInt64BE(0).toString() }, metrics: { @@ -100,7 +100,7 @@ describe('Plugin', () => { [ERROR_TYPE]: error.name, [ERROR_MESSAGE]: error.message, [ERROR_STACK]: error.stack, - 'component': 'kafkajs' + component: 'kafkajs' }) }) @@ -158,7 +158,7 @@ describe('Plugin', () => { service: expectedSchema.receive.serviceName, meta: { 'span.kind': 'consumer', - 'component': 'kafkajs', + component: 'kafkajs', 'pathway.hash': expectedConsumerHash.readBigUInt64BE(0).toString() }, resource: testTopic, @@ -222,7 +222,7 @@ describe('Plugin', () => { [ERROR_TYPE]: fakeError.name, [ERROR_MESSAGE]: fakeError.message, [ERROR_STACK]: fakeError.stack, - 'component': 'kafkajs' + component: 'kafkajs' }, resource: testTopic, error: 1, diff --git a/packages/datadog-plugin-kafkajs/test/integration-test/client.spec.js b/packages/datadog-plugin-kafkajs/test/integration-test/client.spec.js index 34196638047..af231c00915 100644 --- a/packages/datadog-plugin-kafkajs/test/integration-test/client.spec.js +++ b/packages/datadog-plugin-kafkajs/test/integration-test/client.spec.js @@ -16,7 +16,7 @@ describe('esm', () => { before(async function () { this.timeout(20000) sandbox = await createSandbox([`'kafkajs@${version}'`], false, [ - `./packages/datadog-plugin-kafkajs/test/integration-test/*`]) + './packages/datadog-plugin-kafkajs/test/integration-test/*']) }) after(async () => { diff --git a/packages/datadog-plugin-kafkajs/test/naming.js b/packages/datadog-plugin-kafkajs/test/naming.js index 80d44c86b87..78b1f5f3a1c 100644 --- a/packages/datadog-plugin-kafkajs/test/naming.js +++ b/packages/datadog-plugin-kafkajs/test/naming.js @@ -24,6 +24,6 @@ const rawExpectedSchema = { } module.exports = { - rawExpectedSchema: rawExpectedSchema, + rawExpectedSchema, expectedSchema: resolveNaming(rawExpectedSchema) } diff --git a/packages/datadog-plugin-koa/test/index.spec.js b/packages/datadog-plugin-koa/test/index.spec.js index 4ccbbcf71ad..f37db4acf32 100644 --- a/packages/datadog-plugin-koa/test/index.spec.js +++ b/packages/datadog-plugin-koa/test/index.spec.js @@ -568,7 +568,7 @@ describe('Plugin', () => { expect(spans[1].resource).to.match(/^dispatch/) expect(spans[1].meta).to.include({ [ERROR_TYPE]: error.name, - 'component': 'koa' + component: 'koa' }) expect(spans[1].error).to.equal(1) }) @@ -588,7 +588,7 @@ describe('Plugin', () => { let ws beforeEach(() => { - WebSocket = require(`../../../versions/ws@6.1.0`).get() + WebSocket = require('../../../versions/ws@6.1.0').get() websockify = require(`../../../versions/koa-websocket@${wsVersion}`).get() }) diff --git a/packages/datadog-plugin-koa/test/integration-test/client.spec.js b/packages/datadog-plugin-koa/test/integration-test/client.spec.js index 45e8c7344a9..2216dd6129e 100644 --- a/packages/datadog-plugin-koa/test/integration-test/client.spec.js +++ b/packages/datadog-plugin-koa/test/integration-test/client.spec.js @@ -17,7 +17,7 @@ describe('esm', () => { before(async function () { this.timeout(50000) sandbox = await createSandbox([`'koa@${version}'`], false, - [`./packages/datadog-plugin-koa/test/integration-test/*`]) + ['./packages/datadog-plugin-koa/test/integration-test/*']) }) after(async function () { diff --git a/packages/datadog-plugin-limitd-client/test/integration-test/client.spec.js b/packages/datadog-plugin-limitd-client/test/integration-test/client.spec.js index 7cc554bf9a1..5ed8cd12c9d 100644 --- a/packages/datadog-plugin-limitd-client/test/integration-test/client.spec.js +++ b/packages/datadog-plugin-limitd-client/test/integration-test/client.spec.js @@ -17,7 +17,7 @@ describe('esm', () => { before(async function () { this.timeout(20000) sandbox = await createSandbox([`'limitd-client@${version}'`], false, [ - `./packages/datadog-plugin-limitd-client/test/integration-test/*`]) + './packages/datadog-plugin-limitd-client/test/integration-test/*']) }) after(async () => { diff --git a/packages/datadog-plugin-mariadb/test/index.spec.js b/packages/datadog-plugin-mariadb/test/index.spec.js index 967a5c9dc52..65828c17b25 100644 --- a/packages/datadog-plugin-mariadb/test/index.spec.js +++ b/packages/datadog-plugin-mariadb/test/index.spec.js @@ -67,6 +67,7 @@ describe('Plugin', () => { tracer.scope().activate(span, () => { const span = tracer.scope().active() + // eslint-disable-next-line n/handle-callback-err connection.query('SELECT 1 + 1 AS solution', (err, results, fields) => { try { expect(results).to.not.be.null diff --git a/packages/datadog-plugin-mariadb/test/integration-test/client.spec.js b/packages/datadog-plugin-mariadb/test/integration-test/client.spec.js index d41905c29dd..8ff3272fba9 100644 --- a/packages/datadog-plugin-mariadb/test/integration-test/client.spec.js +++ b/packages/datadog-plugin-mariadb/test/integration-test/client.spec.js @@ -18,7 +18,7 @@ describe('esm', () => { before(async function () { this.timeout(20000) sandbox = await createSandbox([`'mariadb@${version}'`], false, [ - `./packages/datadog-plugin-mariadb/test/integration-test/*`]) + './packages/datadog-plugin-mariadb/test/integration-test/*']) }) after(async () => { diff --git a/packages/datadog-plugin-mariadb/test/naming.js b/packages/datadog-plugin-mariadb/test/naming.js index 2f01944c66f..81bc7d60f0d 100644 --- a/packages/datadog-plugin-mariadb/test/naming.js +++ b/packages/datadog-plugin-mariadb/test/naming.js @@ -14,6 +14,6 @@ const rawExpectedSchema = { } module.exports = { - rawExpectedSchema: rawExpectedSchema, + rawExpectedSchema, expectedSchema: resolveNaming(rawExpectedSchema) } diff --git a/packages/datadog-plugin-memcached/test/integration-test/client.spec.js b/packages/datadog-plugin-memcached/test/integration-test/client.spec.js index 277e330f9d0..78012aa8b3a 100644 --- a/packages/datadog-plugin-memcached/test/integration-test/client.spec.js +++ b/packages/datadog-plugin-memcached/test/integration-test/client.spec.js @@ -17,7 +17,7 @@ describe('esm', () => { before(async function () { this.timeout(50000) sandbox = await createSandbox([`'memcached@${version}'`], false, [ - `./packages/datadog-plugin-memcached/test/integration-test/*`]) + './packages/datadog-plugin-memcached/test/integration-test/*']) }) after(async function () { diff --git a/packages/datadog-plugin-memcached/test/naming.js b/packages/datadog-plugin-memcached/test/naming.js index a92fd57a43e..80a164f42d4 100644 --- a/packages/datadog-plugin-memcached/test/naming.js +++ b/packages/datadog-plugin-memcached/test/naming.js @@ -14,6 +14,6 @@ const rawExpectedSchema = { } module.exports = { - rawExpectedSchema: rawExpectedSchema, + rawExpectedSchema, expectedSchema: resolveNaming(rawExpectedSchema) } diff --git a/packages/datadog-plugin-microgateway-core/test/integration-test/client.spec.js b/packages/datadog-plugin-microgateway-core/test/integration-test/client.spec.js index 33a27585833..ad54a7e0ad2 100644 --- a/packages/datadog-plugin-microgateway-core/test/integration-test/client.spec.js +++ b/packages/datadog-plugin-microgateway-core/test/integration-test/client.spec.js @@ -23,7 +23,7 @@ describe('esm', () => { before(async function () { this.timeout(20000) sandbox = await createSandbox([`'microgateway-core@${version}'`, 'get-port'], false, [ - `./packages/datadog-plugin-microgateway-core/test/integration-test/*`]) + './packages/datadog-plugin-microgateway-core/test/integration-test/*']) }) after(async () => { diff --git a/packages/datadog-plugin-microgateway-core/test/proxy.js b/packages/datadog-plugin-microgateway-core/test/proxy.js index 42e73b340de..dd9f0fdad4f 100644 --- a/packages/datadog-plugin-microgateway-core/test/proxy.js +++ b/packages/datadog-plugin-microgateway-core/test/proxy.js @@ -36,6 +36,7 @@ module.exports = http.createServer((req, res) => { cltSocket.pipe(targetConnection) } + // eslint-disable-next-line n/no-deprecated-api const targetUrl = url.parse(util.format('%s://%s', proto, req.url)) let targetConnection diff --git a/packages/datadog-plugin-mocha/test/index.spec.js b/packages/datadog-plugin-mocha/test/index.spec.js index ce35816b5bd..e88fab23370 100644 --- a/packages/datadog-plugin-mocha/test/index.spec.js +++ b/packages/datadog-plugin-mocha/test/index.spec.js @@ -323,12 +323,12 @@ describe('Plugin', () => { }) expect(testSpan.meta[COMPONENT]).to.equal('mocha') expect(testSpan.meta[ERROR_TYPE]).to.equal('TypeError') - const beginning = `mocha-fail-hook-sync "before each" hook for "will not run but be reported as failed": ` + const beginning = 'mocha-fail-hook-sync "before each" hook for "will not run but be reported as failed": ' expect(testSpan.meta[ERROR_MESSAGE].startsWith(beginning)).to.equal(true) const errorMsg = testSpan.meta[ERROR_MESSAGE].replace(beginning, '') expect( - errorMsg === `Cannot set property 'error' of undefined` || - errorMsg === `Cannot set properties of undefined (setting 'error')` + errorMsg === 'Cannot set property \'error\' of undefined' || + errorMsg === 'Cannot set properties of undefined (setting \'error\')' ).to.equal(true) expect(testSpan.meta[ERROR_STACK]).not.to.be.undefined }).then(done, done) diff --git a/packages/datadog-plugin-moleculer/test/integration-test/client.spec.js b/packages/datadog-plugin-moleculer/test/integration-test/client.spec.js index 34e663bfeb8..ba6618863d5 100644 --- a/packages/datadog-plugin-moleculer/test/integration-test/client.spec.js +++ b/packages/datadog-plugin-moleculer/test/integration-test/client.spec.js @@ -21,7 +21,7 @@ describe('esm', () => { before(async function () { this.timeout(20000) sandbox = await createSandbox([`'moleculer@${version}'`, 'get-port'], false, [ - `./packages/datadog-plugin-moleculer/test/integration-test/*`]) + './packages/datadog-plugin-moleculer/test/integration-test/*']) }) after(async () => { diff --git a/packages/datadog-plugin-moleculer/test/naming.js b/packages/datadog-plugin-moleculer/test/naming.js index a19dc44bedf..ee339847550 100644 --- a/packages/datadog-plugin-moleculer/test/naming.js +++ b/packages/datadog-plugin-moleculer/test/naming.js @@ -24,6 +24,6 @@ const rawExpectedSchema = { } module.exports = { - rawExpectedSchema: rawExpectedSchema, + rawExpectedSchema, expectedSchema: resolveNaming(rawExpectedSchema) } diff --git a/packages/datadog-plugin-mongodb-core/test/core.spec.js b/packages/datadog-plugin-mongodb-core/test/core.spec.js index 31f1c0e6d7e..fe4ad564f9b 100644 --- a/packages/datadog-plugin-mongodb-core/test/core.spec.js +++ b/packages/datadog-plugin-mongodb-core/test/core.spec.js @@ -117,7 +117,7 @@ describe('Plugin', () => { .use(traces => { const span = traces[0][0] const resource = `find test.${collection}` - const query = `{"_id":"?"}` + const query = '{"_id":"?"}' expect(span).to.have.property('resource', resource) expect(span.meta).to.have.property('mongodb.query', query) @@ -138,7 +138,7 @@ describe('Plugin', () => { .use(traces => { const span = traces[0][0] const resource = `find test.${collection}` - const query = `{"_id":"9999999999999999999999"}` + const query = '{"_id":"9999999999999999999999"}' expect(span).to.have.property('resource', resource) expect(span.meta).to.have.property('mongodb.query', query) @@ -167,7 +167,7 @@ describe('Plugin', () => { }) it('should stringify BSON objects', done => { - const BSON = require(`../../../versions/bson@4.0.0`).get() + const BSON = require('../../../versions/bson@4.0.0').get() const id = '123456781234567812345678' agent @@ -195,7 +195,7 @@ describe('Plugin', () => { .use(traces => { const span = traces[0][0] const resource = `find test.${collection}` - const query = `{"_id":"1234"}` + const query = '{"_id":"1234"}' expect(span).to.have.property('resource', resource) expect(span.meta).to.have.property('mongodb.query', query) @@ -284,7 +284,7 @@ describe('Plugin', () => { .use(traces => { const span = traces[0][0] const resource = `find test.${collection}` - const query = `{"foo":1,"bar":{"baz":[1,2,3]}}` + const query = '{"foo":1,"bar":{"baz":[1,2,3]}}' expect(span).to.have.property('resource', resource) expect(span.meta).to.have.property('mongodb.query', query) diff --git a/packages/datadog-plugin-mongodb-core/test/integration-test/client.spec.js b/packages/datadog-plugin-mongodb-core/test/integration-test/client.spec.js index 950ef6fb7e8..710e3be2fb9 100644 --- a/packages/datadog-plugin-mongodb-core/test/integration-test/client.spec.js +++ b/packages/datadog-plugin-mongodb-core/test/integration-test/client.spec.js @@ -24,7 +24,7 @@ describe('esm', () => { before(async function () { this.timeout(30000) sandbox = await createSandbox([`'mongodb@${version}'`], false, [ - `./packages/datadog-plugin-mongodb-core/test/integration-test/*`]) + './packages/datadog-plugin-mongodb-core/test/integration-test/*']) }) after(async function () { @@ -58,7 +58,7 @@ describe('esm', () => { before(async function () { this.timeout(30000) sandbox = await createSandbox([`'mongodb-core@${version}'`], false, [ - `./packages/datadog-plugin-mongodb-core/test/integration-test/*`]) + './packages/datadog-plugin-mongodb-core/test/integration-test/*']) }) after(async function () { diff --git a/packages/datadog-plugin-mongodb-core/test/leak.js b/packages/datadog-plugin-mongodb-core/test/leak.js index 427e4bc3f0c..44e0b17fcc4 100644 --- a/packages/datadog-plugin-mongodb-core/test/leak.js +++ b/packages/datadog-plugin-mongodb-core/test/leak.js @@ -24,6 +24,6 @@ test('mongodb-core plugin should not leak', t => { server.connect() function operation (done) { - server.insert(`test.1234`, [{ a: 1 }], {}, done) + server.insert('test.1234', [{ a: 1 }], {}, done) } }) diff --git a/packages/datadog-plugin-mongodb-core/test/mongodb.spec.js b/packages/datadog-plugin-mongodb-core/test/mongodb.spec.js index 3160e2a28df..0e16a3fd71a 100644 --- a/packages/datadog-plugin-mongodb-core/test/mongodb.spec.js +++ b/packages/datadog-plugin-mongodb-core/test/mongodb.spec.js @@ -53,7 +53,7 @@ describe('Plugin', () => { collectionName = id().toString() - BSON = require(`../../../versions/bson@4.0.0`).get() + BSON = require('../../../versions/bson@4.0.0').get() }) afterEach(() => { @@ -108,8 +108,8 @@ describe('Plugin', () => { agent .use(traces => { const span = traces[0][0] - const resource = `planCacheListPlans test.$cmd` - const query = `{}` + const resource = 'planCacheListPlans test.$cmd' + const query = '{}' expect(span).to.have.property('resource', resource) expect(span.meta).to.have.property('mongodb.query', query) @@ -128,7 +128,7 @@ describe('Plugin', () => { .use(traces => { const span = traces[0][0] const resource = `find test.${collectionName}` - const query = `{"_id":"?"}` + const query = '{"_id":"?"}' expect(span).to.have.property('resource', resource) expect(span.meta).to.have.property('mongodb.query', query) @@ -146,7 +146,7 @@ describe('Plugin', () => { .use(traces => { const span = traces[0][0] const resource = `find test.${collectionName}` - const query = `{"_bin":"?"}` + const query = '{"_bin":"?"}' expect(span).to.have.property('resource', resource) expect(span.meta).to.have.property('mongodb.query', query) @@ -184,7 +184,7 @@ describe('Plugin', () => { .use(traces => { const span = traces[0][0] const resource = `find test.${collectionName}` - const query = `{"_time":{"$timestamp":"0"}}` + const query = '{"_time":{"$timestamp":"0"}}' expect(span).to.have.property('resource', resource) expect(span.meta).to.have.property('mongodb.query', query) @@ -202,7 +202,7 @@ describe('Plugin', () => { .use(traces => { const span = traces[0][0] const resource = `find test.${collectionName}` - const query = `{"_id":"?"}` + const query = '{"_id":"?"}' expect(span).to.have.property('resource', resource) expect(span.meta).to.have.property('mongodb.query', query) @@ -220,7 +220,7 @@ describe('Plugin', () => { .use(traces => { const span = traces[0][0] const resource = `find test.${collectionName}` - const query = `{"_id":"1234"}` + const query = '{"_id":"1234"}' expect(span).to.have.property('resource', resource) expect(span.meta).to.have.property('mongodb.query', query) diff --git a/packages/datadog-plugin-mongodb-core/test/naming.js b/packages/datadog-plugin-mongodb-core/test/naming.js index 570301247fe..c5113333a29 100644 --- a/packages/datadog-plugin-mongodb-core/test/naming.js +++ b/packages/datadog-plugin-mongodb-core/test/naming.js @@ -14,6 +14,6 @@ const rawExpectedSchema = { } module.exports = { - rawExpectedSchema: rawExpectedSchema, + rawExpectedSchema, expectedSchema: resolveNaming(rawExpectedSchema) } diff --git a/packages/datadog-plugin-mongoose/test/integration-test/client.spec.js b/packages/datadog-plugin-mongoose/test/integration-test/client.spec.js index d393fdd774b..819bbfae63f 100644 --- a/packages/datadog-plugin-mongoose/test/integration-test/client.spec.js +++ b/packages/datadog-plugin-mongoose/test/integration-test/client.spec.js @@ -25,7 +25,7 @@ describe('esm', () => { before(async function () { this.timeout(20000) sandbox = await createSandbox([`'mongoose@${version}'`], false, [ - `./packages/datadog-plugin-mongoose/test/integration-test/*`]) + './packages/datadog-plugin-mongoose/test/integration-test/*']) }) after(async () => { diff --git a/packages/datadog-plugin-mysql/test/index.spec.js b/packages/datadog-plugin-mysql/test/index.spec.js index e80e608da86..bf8d10ea10d 100644 --- a/packages/datadog-plugin-mysql/test/index.spec.js +++ b/packages/datadog-plugin-mysql/test/index.spec.js @@ -47,6 +47,7 @@ describe('Plugin', () => { tracer.scope().activate(span, () => { const span = tracer.scope().active() + // eslint-disable-next-line n/handle-callback-err connection.query('SELECT 1 + 1 AS solution', (err, results, fields) => { expect(results).to.not.be.null expect(fields).to.not.be.null @@ -305,7 +306,7 @@ describe('Plugin', () => { }) beforeEach(() => { - const plugin = tracer._pluginManager._pluginsByName['mysql'] + const plugin = tracer._pluginManager._pluginsByName.mysql computeStub = sinon.stub(plugin._tracerConfig, 'spanComputePeerService') remapStub = sinon.stub(plugin._tracerConfig, 'peerServiceMapping') }) @@ -423,7 +424,7 @@ describe('Plugin', () => { connection.query('SELECT 1 + 1 AS solution', () => { try { expect(connection._protocol._queue[0].sql).to.equal( - `/*dddbs='~!%40%23%24%25%5E%26*()_%2B%7C%3F%3F%2F%3C%3E',dde='tester',` + + '/*dddbs=\'~!%40%23%24%25%5E%26*()_%2B%7C%3F%3F%2F%3C%3E\',dde=\'tester\',' + `ddps='test',ddpv='${ddpv}'*/ SELECT 1 + 1 AS solution`) done() } catch (e) { diff --git a/packages/datadog-plugin-mysql/test/integration-test/client.spec.js b/packages/datadog-plugin-mysql/test/integration-test/client.spec.js index 9fb59247676..621e8fcd07c 100644 --- a/packages/datadog-plugin-mysql/test/integration-test/client.spec.js +++ b/packages/datadog-plugin-mysql/test/integration-test/client.spec.js @@ -20,7 +20,7 @@ describe('esm', () => { before(async function () { this.timeout(20000) sandbox = await createSandbox([`'mysql@${version}'`], false, [ - `./packages/datadog-plugin-mysql/test/integration-test/*`]) + './packages/datadog-plugin-mysql/test/integration-test/*']) }) after(async () => { diff --git a/packages/datadog-plugin-mysql/test/naming.js b/packages/datadog-plugin-mysql/test/naming.js index aa9f1c95555..d9f2342d5d1 100644 --- a/packages/datadog-plugin-mysql/test/naming.js +++ b/packages/datadog-plugin-mysql/test/naming.js @@ -14,6 +14,6 @@ const rawExpectedSchema = { } module.exports = { - rawExpectedSchema: rawExpectedSchema, + rawExpectedSchema, expectedSchema: resolveNaming(rawExpectedSchema) } diff --git a/packages/datadog-plugin-mysql2/test/index.spec.js b/packages/datadog-plugin-mysql2/test/index.spec.js index a8f372ed48b..09e1794e0e1 100644 --- a/packages/datadog-plugin-mysql2/test/index.spec.js +++ b/packages/datadog-plugin-mysql2/test/index.spec.js @@ -57,6 +57,7 @@ describe('Plugin', () => { tracer.scope().activate(span, () => { const span = tracer.scope().active() + // eslint-disable-next-line n/handle-callback-err connection.query('SELECT 1 + 1 AS solution', (err, results, fields) => { try { expect(results).to.not.be.null @@ -367,7 +368,7 @@ describe('Plugin', () => { it('should contain comment in query text', done => { const connect = connection.query('SELECT 1 + 1 AS solution', (...args) => { try { - expect(connect.sql).to.equal(`/*dddbs='serviced',dde='tester',` + + expect(connect.sql).to.equal('/*dddbs=\'serviced\',dde=\'tester\',' + `ddps='test',ddpv='${ddpv}'*/ SELECT 1 + 1 AS solution`) } catch (e) { done(e) @@ -413,7 +414,7 @@ describe('Plugin', () => { const connect = connection.query('SELECT 1 + 1 AS solution', () => { try { expect(connect.sql).to.equal( - `/*dddbs='~!%40%23%24%25%5E%26*()_%2B%7C%3F%3F%2F%3C%3E',dde='tester',` + + '/*dddbs=\'~!%40%23%24%25%5E%26*()_%2B%7C%3F%3F%2F%3C%3E\',dde=\'tester\',' + `ddps='test',ddpv='${ddpv}'*/ SELECT 1 + 1 AS solution`) done() } catch (e) { diff --git a/packages/datadog-plugin-mysql2/test/integration-test/client.spec.js b/packages/datadog-plugin-mysql2/test/integration-test/client.spec.js index 8f511647f8c..6be107f34e0 100644 --- a/packages/datadog-plugin-mysql2/test/integration-test/client.spec.js +++ b/packages/datadog-plugin-mysql2/test/integration-test/client.spec.js @@ -21,7 +21,7 @@ describe('esm', () => { before(async function () { this.timeout(20000) sandbox = await createSandbox([`'mysql2@${version}'`], false, [ - `./packages/datadog-plugin-mysql2/test/integration-test/*`]) + './packages/datadog-plugin-mysql2/test/integration-test/*']) }) after(async () => { diff --git a/packages/datadog-plugin-mysql2/test/naming.js b/packages/datadog-plugin-mysql2/test/naming.js index aa9f1c95555..d9f2342d5d1 100644 --- a/packages/datadog-plugin-mysql2/test/naming.js +++ b/packages/datadog-plugin-mysql2/test/naming.js @@ -14,6 +14,6 @@ const rawExpectedSchema = { } module.exports = { - rawExpectedSchema: rawExpectedSchema, + rawExpectedSchema, expectedSchema: resolveNaming(rawExpectedSchema) } diff --git a/packages/datadog-plugin-net/test/index.spec.js b/packages/datadog-plugin-net/test/index.spec.js index 0f47b0c9034..ee91149d9ba 100644 --- a/packages/datadog-plugin-net/test/index.spec.js +++ b/packages/datadog-plugin-net/test/index.spec.js @@ -111,7 +111,7 @@ describe('Plugin', () => { service: 'test', resource: `localhost:${port}`, meta: { - 'component': 'net', + component: 'net', 'span.kind': 'client', 'tcp.family': 'IPv4', 'tcp.remote.host': 'localhost', @@ -142,7 +142,7 @@ describe('Plugin', () => { service: 'test', resource: `localhost:${port}`, meta: { - 'component': 'net', + component: 'net', 'span.kind': 'client', 'tcp.family': 'IPv4', 'tcp.remote.host': 'localhost', @@ -166,7 +166,7 @@ describe('Plugin', () => { service: 'test', resource: '/tmp/dd-trace.sock', meta: { - 'component': 'net', + component: 'net', 'span.kind': 'client', 'ipc.path': '/tmp/dd-trace.sock' }, @@ -193,7 +193,7 @@ describe('Plugin', () => { resource: `localhost:${port}` }) expect(traces[0][0].meta).to.deep.include({ - 'component': 'net', + component: 'net', 'span.kind': 'client', 'tcp.family': 'IPv4', 'tcp.remote.host': 'localhost', diff --git a/packages/datadog-plugin-net/test/integration-test/client.spec.js b/packages/datadog-plugin-net/test/integration-test/client.spec.js index 587b3298cf2..c0810e36383 100644 --- a/packages/datadog-plugin-net/test/integration-test/client.spec.js +++ b/packages/datadog-plugin-net/test/integration-test/client.spec.js @@ -20,7 +20,7 @@ describe('esm', () => { before(async function () { this.timeout(20000) sandbox = await createSandbox(['net', 'get-port'], false, [ - `./packages/datadog-plugin-net/test/integration-test/*`]) + './packages/datadog-plugin-net/test/integration-test/*']) }) after(async () => { diff --git a/packages/datadog-plugin-next/src/index.js b/packages/datadog-plugin-next/src/index.js index 5cb0fec304b..0ffad16b5b6 100644 --- a/packages/datadog-plugin-next/src/index.js +++ b/packages/datadog-plugin-next/src/index.js @@ -58,7 +58,7 @@ class NextPlugin extends ServerPlugin { if (!store) return const span = store.span - const error = span.context()._tags['error'] + const error = span.context()._tags.error const requestError = req.error || nextRequest.error if (requestError) { diff --git a/packages/datadog-plugin-next/test/datadog.js b/packages/datadog-plugin-next/test/datadog.js index 1e1008cf5d4..565fe15db99 100644 --- a/packages/datadog-plugin-next/test/datadog.js +++ b/packages/datadog-plugin-next/test/datadog.js @@ -1,8 +1,4 @@ -module.exports = require('../../..').init({ - service: 'test', - flushInterval: 0, - plugins: false -}).use('next', process.env.WITH_CONFIG ? { +const config = { validateStatus: code => false, hooks: { request: (span, req) => { @@ -15,4 +11,10 @@ module.exports = require('../../..').init({ span.setTag('foo', 'bar') } } -} : true).use('http') +} + +module.exports = require('../../..').init({ + service: 'test', + flushInterval: 0, + plugins: false +}).use('next', process.env.WITH_CONFIG ? config : true).use('http') diff --git a/packages/datadog-plugin-next/test/index.spec.js b/packages/datadog-plugin-next/test/index.spec.js index 9b5728eeb60..25143c14608 100644 --- a/packages/datadog-plugin-next/test/index.spec.js +++ b/packages/datadog-plugin-next/test/index.spec.js @@ -2,6 +2,7 @@ /* eslint import/no-extraneous-dependencies: ["error", {"packageDir": ['./']}] */ +const path = require('path') const axios = require('axios') const getPort = require('get-port') const { execSync, spawn } = require('child_process') @@ -12,7 +13,8 @@ const { DD_MAJOR, NODE_MAJOR } = require('../../../version') const { rawExpectedSchema } = require('./naming') const BUILD_COMMAND = NODE_MAJOR < 18 - ? 'yarn exec next build' : 'NODE_OPTIONS=--openssl-legacy-provider yarn exec next build' + ? 'yarn exec next build' + : 'NODE_OPTIONS=--openssl-legacy-provider yarn exec next build' let VERSIONS_TO_TEST = NODE_MAJOR < 18 ? '>=11.1 <13.2' : '>=11.1' VERSIONS_TO_TEST = DD_MAJOR >= 4 ? VERSIONS_TO_TEST : '>=9.5 <11.1' @@ -25,7 +27,7 @@ describe('Plugin', function () { // TODO: Figure out why 10.x tests are failing. withVersions('next', 'next', VERSIONS_TO_TEST, version => { - const pkg = require(`${__dirname}/../../../versions/next@${version}/node_modules/next/package.json`) + const pkg = require(`../../../versions/next@${version}/node_modules/next/package.json`) const startServer = ({ withConfig, standalone }, schemaVersion = 'v0', defaultToGlobalService = false) => { before(async () => { @@ -37,7 +39,7 @@ describe('Plugin', function () { before(function (done) { this.timeout(40000) const cwd = standalone - ? `${__dirname}/.next/standalone` + ? path.join(__dirname, '.next/standalone') : __dirname server = spawn('node', ['server'], { @@ -50,6 +52,7 @@ describe('Plugin', function () { WITH_CONFIG: withConfig, DD_TRACE_SPAN_ATTRIBUTE_SCHEMA: schemaVersion, DD_TRACE_REMOVE_INTEGRATION_SERVICE_NAMES_ENABLED: defaultToGlobalService, + // eslint-disable-next-line n/no-path-concat NODE_OPTIONS: `--require ${__dirname}/datadog.js`, HOSTNAME: '127.0.0.1', TIMES_HOOK_CALLED: 0 @@ -84,8 +87,8 @@ describe('Plugin', function () { this.timeout(120 * 1000) // Webpack is very slow and builds on every test run const cwd = __dirname - const pkg = require(`${__dirname}/../../../versions/next@${version}/package.json`) - const realVersion = require(`${__dirname}/../../../versions/next@${version}`).version() + const pkg = require(`../../../versions/next@${version}/package.json`) + const realVersion = require(`../../../versions/next@${version}`).version() delete pkg.workspaces @@ -95,7 +98,7 @@ describe('Plugin', function () { // https://nextjs.org/blog/next-9-5#webpack-5-support-beta if (realVersion.startsWith('9')) pkg.resolutions = { webpack: '^5.0.0' } - writeFileSync(`${__dirname}/package.json`, JSON.stringify(pkg, null, 2)) + writeFileSync(path.join(__dirname, 'package.json'), JSON.stringify(pkg, null, 2)) // installing here for standalone purposes, copying `nodules` above was not generating the server file properly // if there is a way to re-use nodules from somewhere in the versions folder, this `execSync` will be reverted @@ -113,8 +116,8 @@ describe('Plugin', function () { if (satisfiesStandalone(realVersion)) { // copy public and static files to the `standalone` folder - const publicOrigin = `${__dirname}/public` - const publicDestination = `${__dirname}/.next/standalone/public` + const publicOrigin = path.join(__dirname, 'public') + const publicDestination = path.join(__dirname, '.next/standalone/public') execSync(`mkdir ${publicDestination}`) execSync(`cp ${publicOrigin}/test.txt ${publicDestination}/test.txt`) } @@ -128,7 +131,7 @@ describe('Plugin', function () { '.next', 'yarn.lock' ] - const paths = files.map(file => `${__dirname}/${file}`) + const paths = files.map(file => path.join(__dirname, file)) execSync(`rm -rf ${paths.join(' ')}`) }) @@ -395,7 +398,7 @@ describe('Plugin', function () { it('should do automatic instrumentation for static chunks', done => { // get first static chunk file programatically - const file = readdirSync(`${__dirname}/.next/static/chunks`)[0] + const file = readdirSync(path.join(__dirname, '.next/static/chunks'))[0] agent .use(traces => { @@ -457,7 +460,7 @@ describe('Plugin', function () { .use(traces => { const spans = traces[0] - expect(spans[1]).to.have.property('resource', `GET /api/appDir/[name]`) + expect(spans[1]).to.have.property('resource', 'GET /api/appDir/[name]') }) .then(done) .catch(done) @@ -472,7 +475,7 @@ describe('Plugin', function () { .use(traces => { const spans = traces[0] - expect(spans[1]).to.have.property('resource', `GET /appDir/[name]`) + expect(spans[1]).to.have.property('resource', 'GET /appDir/[name]') expect(spans[1].meta).to.have.property('http.status_code', '200') }) .then(done) diff --git a/packages/datadog-plugin-next/test/integration-test/client.spec.js b/packages/datadog-plugin-next/test/integration-test/client.spec.js index 5138d619046..054e2fc6357 100644 --- a/packages/datadog-plugin-next/test/integration-test/client.spec.js +++ b/packages/datadog-plugin-next/test/integration-test/client.spec.js @@ -13,8 +13,10 @@ const { NODE_MAJOR } = require('../../../../version') const hookFile = 'dd-trace/loader-hook.mjs' const BUILD_COMMAND = NODE_MAJOR < 18 - ? 'yarn exec next build' : 'NODE_OPTIONS=--openssl-legacy-provider yarn exec next build' -const NODE_OPTIONS = NODE_MAJOR < 18 ? `--loader=${hookFile} --require dd-trace/init` + ? 'yarn exec next build' + : 'NODE_OPTIONS=--openssl-legacy-provider yarn exec next build' +const NODE_OPTIONS = NODE_MAJOR < 18 + ? `--loader=${hookFile} --require dd-trace/init` : `--loader=${hookFile} --require dd-trace/init --openssl-legacy-provider` const VERSIONS_TO_TEST = NODE_MAJOR < 18 ? '>=11.1 <13.2' : '>=11.1' diff --git a/packages/datadog-plugin-next/test/server.js b/packages/datadog-plugin-next/test/server.js index e77c478b8a6..cc69d2833b9 100644 --- a/packages/datadog-plugin-next/test/server.js +++ b/packages/datadog-plugin-next/test/server.js @@ -3,6 +3,7 @@ const { PORT, HOSTNAME } = process.env const { createServer } = require('http') +// eslint-disable-next-line n/no-deprecated-api const { parse } = require('url') const next = require('next') // eslint-disable-line import/no-extraneous-dependencies diff --git a/packages/datadog-plugin-openai/src/index.js b/packages/datadog-plugin-openai/src/index.js index 71ed800dfd5..94739bf4d47 100644 --- a/packages/datadog-plugin-openai/src/index.js +++ b/packages/datadog-plugin-openai/src/index.js @@ -89,7 +89,7 @@ class OpenApiPlugin extends TracingPlugin { store.prompt = prompt if (typeof prompt === 'string' || (Array.isArray(prompt) && typeof prompt[0] === 'number')) { // This is a single prompt, either String or [Number] - tags[`openai.request.prompt`] = normalizeStringOrTokenArray(prompt, true) + tags['openai.request.prompt'] = normalizeStringOrTokenArray(prompt, true) } else if (Array.isArray(prompt)) { // This is multiple prompts, either [String] or [[Number]] for (let i = 0; i < prompt.length; i++) { @@ -101,7 +101,7 @@ class OpenApiPlugin extends TracingPlugin { // createEdit, createEmbedding, createModeration if ('input' in payload) { const normalized = normalizeStringOrTokenArray(payload.input, false) - tags[`openai.request.input`] = truncateText(normalized) + tags['openai.request.input'] = truncateText(normalized) store.input = normalized } @@ -203,7 +203,7 @@ class OpenApiPlugin extends TracingPlugin { // We don't know most information about the request when it fails - const tags = [`error:1`] + const tags = ['error:1'] this.metrics.distribution('openai.request.duration', span._duration * 1000, tags) this.metrics.increment('openai.request.error', 1, tags) @@ -215,7 +215,7 @@ class OpenApiPlugin extends TracingPlugin { `org:${headers['openai-organization']}`, `endpoint:${endpoint}`, // just "/v1/models", no method `model:${headers['openai-model']}`, - `error:0` + 'error:0' ] this.metrics.distribution('openai.request.duration', duration * 1000, tags) diff --git a/packages/datadog-plugin-openai/test/index.spec.js b/packages/datadog-plugin-openai/test/index.spec.js index ccf586645c0..392c3cca8f1 100644 --- a/packages/datadog-plugin-openai/test/index.spec.js +++ b/packages/datadog-plugin-openai/test/index.spec.js @@ -83,17 +83,17 @@ describe('Plugin', () => { scope = nock('https://api.openai.com:443') .post('/v1/completions') .reply(200, { - 'id': 'cmpl-7GWDlQbOrAYGmeFZtoRdOEjDXDexM', - 'object': 'text_completion', - 'created': 1684171461, - 'model': 'text-davinci-002', - 'choices': [{ - 'text': 'FOO BAR BAZ', - 'index': 0, - 'logprobs': null, - 'finish_reason': 'length' + id: 'cmpl-7GWDlQbOrAYGmeFZtoRdOEjDXDexM', + object: 'text_completion', + created: 1684171461, + model: 'text-davinci-002', + choices: [{ + text: 'FOO BAR BAZ', + index: 0, + logprobs: null, + finish_reason: 'length' }], - 'usage': { 'prompt_tokens': 3, 'completion_tokens': 16, 'total_tokens': 19 } + usage: { prompt_tokens: 3, completion_tokens: 16, total_tokens: 19 } }, [ 'Date', 'Mon, 15 May 2023 17:24:22 GMT', 'Content-Type', 'application/json', @@ -164,7 +164,7 @@ describe('Plugin', () => { presence_penalty: -0.1, frequency_penalty: 0.11, best_of: 2, - logit_bias: { '50256': 30 }, + logit_bias: { 50256: 30 }, user: 'hunter2' }) @@ -252,16 +252,16 @@ describe('Plugin', () => { scope = nock('https://api.openai.com:443') .post('/v1/embeddings') .reply(200, { - 'object': 'list', - 'data': [{ - 'object': 'embedding', - 'index': 0, - 'embedding': [-0.0034387498, -0.026400521] + object: 'list', + data: [{ + object: 'embedding', + index: 0, + embedding: [-0.0034387498, -0.026400521] }], - 'model': 'text-embedding-ada-002-v2', - 'usage': { - 'prompt_tokens': 2, - 'total_tokens': 2 + model: 'text-embedding-ada-002-v2', + usage: { + prompt_tokens: 2, + total_tokens: 2 } }, [ 'Date', 'Mon, 15 May 2023 20:49:06 GMT', @@ -325,51 +325,51 @@ describe('Plugin', () => { scope = nock('https://api.openai.com:443') .get('/v1/models') .reply(200, { - 'object': 'list', - 'data': [ + object: 'list', + data: [ { - 'id': 'whisper-1', - 'object': 'model', - 'created': 1677532384, - 'owned_by': 'openai-internal', - 'permission': [{ - 'id': 'modelperm-KlsZlfft3Gma8pI6A8rTnyjs', - 'object': 'model_permission', - 'created': 1683912666, - 'allow_create_engine': false, - 'allow_sampling': true, - 'allow_logprobs': true, - 'allow_search_indices': false, - 'allow_view': true, - 'allow_fine_tuning': false, - 'organization': '*', - 'group': null, - 'is_blocking': false + id: 'whisper-1', + object: 'model', + created: 1677532384, + owned_by: 'openai-internal', + permission: [{ + id: 'modelperm-KlsZlfft3Gma8pI6A8rTnyjs', + object: 'model_permission', + created: 1683912666, + allow_create_engine: false, + allow_sampling: true, + allow_logprobs: true, + allow_search_indices: false, + allow_view: true, + allow_fine_tuning: false, + organization: '*', + group: null, + is_blocking: false }], - 'root': 'whisper-1', - 'parent': null + root: 'whisper-1', + parent: null }, { - 'id': 'babbage', - 'object': 'model', - 'created': 1649358449, - 'owned_by': 'openai', - 'permission': [{ - 'id': 'modelperm-49FUp5v084tBB49tC4z8LPH5', - 'object': 'model_permission', - 'created': 1669085501, - 'allow_create_engine': false, - 'allow_sampling': true, - 'allow_logprobs': true, - 'allow_search_indices': false, - 'allow_view': true, - 'allow_fine_tuning': false, - 'organization': '*', - 'group': null, - 'is_blocking': false + id: 'babbage', + object: 'model', + created: 1649358449, + owned_by: 'openai', + permission: [{ + id: 'modelperm-49FUp5v084tBB49tC4z8LPH5', + object: 'model_permission', + created: 1669085501, + allow_create_engine: false, + allow_sampling: true, + allow_logprobs: true, + allow_search_indices: false, + allow_view: true, + allow_fine_tuning: false, + organization: '*', + group: null, + is_blocking: false }], - 'root': 'babbage', - 'parent': null + root: 'babbage', + parent: null } ] }, [ @@ -417,26 +417,26 @@ describe('Plugin', () => { scope = nock('https://api.openai.com:443') .get('/v1/models/gpt-4') .reply(200, { - 'id': 'gpt-4', - 'object': 'model', - 'created': 1678604602, - 'owned_by': 'openai', - 'permission': [{ - 'id': 'modelperm-ffiDrbtOGIZuczdJcFuOo2Mi', - 'object': 'model_permission', - 'created': 1684185078, - 'allow_create_engine': false, - 'allow_sampling': false, - 'allow_logprobs': false, - 'allow_search_indices': false, - 'allow_view': false, - 'allow_fine_tuning': false, - 'organization': '*', - 'group': null, - 'is_blocking': false + id: 'gpt-4', + object: 'model', + created: 1678604602, + owned_by: 'openai', + permission: [{ + id: 'modelperm-ffiDrbtOGIZuczdJcFuOo2Mi', + object: 'model_permission', + created: 1684185078, + allow_create_engine: false, + allow_sampling: false, + allow_logprobs: false, + allow_search_indices: false, + allow_view: false, + allow_fine_tuning: false, + organization: '*', + group: null, + is_blocking: false }], - 'root': 'gpt-4', - 'parent': 'stevebob' + root: 'gpt-4', + parent: 'stevebob' }, [ 'Date', 'Mon, 15 May 2023 23:41:40 GMT', 'Content-Type', 'application/json', @@ -495,16 +495,16 @@ describe('Plugin', () => { scope = nock('https://api.openai.com:443') .post('/v1/edits') .reply(200, { - 'object': 'edit', - 'created': 1684267309, - 'choices': [{ - 'text': 'What day of the week is it, Bob?\n', - 'index': 0 + object: 'edit', + created: 1684267309, + choices: [{ + text: 'What day of the week is it, Bob?\n', + index: 0 }], - 'usage': { - 'prompt_tokens': 25, - 'completion_tokens': 28, - 'total_tokens': 53 + usage: { + prompt_tokens: 25, + completion_tokens: 28, + total_tokens: 53 } }, [ 'Date', 'Tue, 16 May 2023 20:01:49 GMT', @@ -556,13 +556,13 @@ describe('Plugin', () => { }) const result = await openai.createEdit({ - 'model': 'text-davinci-edit-001', - 'input': 'What day of the wek is it?', - 'instruction': 'Fix the spelling mistakes', - 'n': 1, - 'temperature': 1.00001, - 'top_p': 0.999, - 'user': 'hunter2' + model: 'text-davinci-edit-001', + input: 'What day of the wek is it?', + instruction: 'Fix the spelling mistakes', + n: 1, + temperature: 1.00001, + top_p: 0.999, + user: 'hunter2' }) expect(result.data.choices[0].text).to.eql('What day of the week is it, Bob?\n') @@ -601,25 +601,25 @@ describe('Plugin', () => { scope = nock('https://api.openai.com:443') .get('/v1/files') .reply(200, { - 'object': 'list', - 'data': [{ - 'object': 'file', - 'id': 'file-foofoofoo', - 'purpose': 'fine-tune-results', - 'filename': 'compiled_results.csv', - 'bytes': 3460, - 'created_at': 1684000162, - 'status': 'processed', - 'status_details': null + object: 'list', + data: [{ + object: 'file', + id: 'file-foofoofoo', + purpose: 'fine-tune-results', + filename: 'compiled_results.csv', + bytes: 3460, + created_at: 1684000162, + status: 'processed', + status_details: null }, { - 'object': 'file', - 'id': 'file-barbarbar', - 'purpose': 'fine-tune-results', - 'filename': 'compiled_results.csv', - 'bytes': 13595, - 'created_at': 1684000508, - 'status': 'processed', - 'status_details': null + object: 'file', + id: 'file-barbarbar', + purpose: 'fine-tune-results', + filename: 'compiled_results.csv', + bytes: 13595, + created_at: 1684000508, + status: 'processed', + status_details: null }] }, [ 'Date', 'Wed, 17 May 2023 21:34:04 GMT', @@ -667,14 +667,14 @@ describe('Plugin', () => { scope = nock('https://api.openai.com:443') .post('/v1/files') .reply(200, { - 'object': 'file', - 'id': 'file-268aYWYhvxWwHb4nIzP9FHM6', - 'purpose': 'fine-tune', - 'filename': 'dave-hal.jsonl', - 'bytes': 356, - 'created_at': 1684362764, - 'status': 'uploaded', - 'status_details': 'foo' // dummy value for testing + object: 'file', + id: 'file-268aYWYhvxWwHb4nIzP9FHM6', + purpose: 'fine-tune', + filename: 'dave-hal.jsonl', + bytes: 356, + created_at: 1684362764, + status: 'uploaded', + status_details: 'foo' // dummy value for testing }, [ 'Date', 'Wed, 17 May 2023 22:32:44 GMT', 'Content-Type', 'application/json', @@ -729,9 +729,9 @@ describe('Plugin', () => { scope = nock('https://api.openai.com:443') .delete('/v1/files/file-268aYWYhvxWwHb4nIzP9FHM6') .reply(200, { - 'object': 'file', - 'id': 'file-268aYWYhvxWwHb4nIzP9FHM6', - 'deleted': true + object: 'file', + id: 'file-268aYWYhvxWwHb4nIzP9FHM6', + deleted: true }, [ 'Date', 'Wed, 17 May 2023 23:03:54 GMT', 'Content-Type', 'application/json', @@ -778,14 +778,14 @@ describe('Plugin', () => { scope = nock('https://api.openai.com:443') .get('/v1/files/file-fIkEUgQPWnVXNKPJsr4pEWiz') .reply(200, { - 'object': 'file', - 'id': 'file-fIkEUgQPWnVXNKPJsr4pEWiz', - 'purpose': 'fine-tune', - 'filename': 'dave-hal.jsonl', - 'bytes': 356, - 'created_at': 1684362764, - 'status': 'uploaded', - 'status_details': 'foo' // dummy value for testing + object: 'file', + id: 'file-fIkEUgQPWnVXNKPJsr4pEWiz', + purpose: 'fine-tune', + filename: 'dave-hal.jsonl', + bytes: 356, + created_at: 1684362764, + status: 'uploaded', + status_details: 'foo' // dummy value for testing }, [ 'Date', 'Wed, 17 May 2023 23:14:02 GMT', 'Content-Type', 'application/json', @@ -890,37 +890,37 @@ describe('Plugin', () => { scope = nock('https://api.openai.com:443') .post('/v1/fine-tunes') .reply(200, { - 'object': 'fine-tune', - 'id': 'ft-10RCfqSvgyEcauomw7VpiYco', - 'hyperparams': { - 'n_epochs': 5, - 'batch_size': 3, - 'prompt_loss_weight': 0.01, - 'learning_rate_multiplier': 0.1 + object: 'fine-tune', + id: 'ft-10RCfqSvgyEcauomw7VpiYco', + hyperparams: { + n_epochs: 5, + batch_size: 3, + prompt_loss_weight: 0.01, + learning_rate_multiplier: 0.1 }, - 'organization_id': 'org-COOLORG', - 'model': 'curie', - 'training_files': [{ - 'object': 'file', - 'id': 'file-t3k1gVSQDHrfZnPckzftlZ4A', - 'purpose': 'fine-tune', - 'filename': 'dave-hal.jsonl', - 'bytes': 356, - 'created_at': 1684365950, - 'status': 'processed', - 'status_details': null + organization_id: 'org-COOLORG', + model: 'curie', + training_files: [{ + object: 'file', + id: 'file-t3k1gVSQDHrfZnPckzftlZ4A', + purpose: 'fine-tune', + filename: 'dave-hal.jsonl', + bytes: 356, + created_at: 1684365950, + status: 'processed', + status_details: null }], - 'validation_files': [], - 'result_files': [], - 'created_at': 1684442489, - 'updated_at': 1684442489, - 'status': 'pending', - 'fine_tuned_model': 'huh', - 'events': [{ - 'object': 'fine-tune-event', - 'level': 'info', - 'message': 'Created fine-tune: ft-10RCfqSvgyEcauomw7VpiYco', - 'created_at': 1684442489 + validation_files: [], + result_files: [], + created_at: 1684442489, + updated_at: 1684442489, + status: 'pending', + fine_tuned_model: 'huh', + events: [{ + object: 'fine-tune-event', + level: 'info', + message: 'Created fine-tune: ft-10RCfqSvgyEcauomw7VpiYco', + created_at: 1684442489 }] }, [ 'Date', 'Thu, 18 May 2023 20:41:30 GMT', @@ -1020,107 +1020,107 @@ describe('Plugin', () => { scope = nock('https://api.openai.com:443') .get('/v1/fine-tunes/ft-10RCfqSvgyEcauomw7VpiYco') .reply(200, { - 'object': 'fine-tune', - 'id': 'ft-10RCfqSvgyEcauomw7VpiYco', - 'hyperparams': { - 'n_epochs': 4, - 'batch_size': 3, - 'prompt_loss_weight': 0.01, - 'learning_rate_multiplier': 0.1 + object: 'fine-tune', + id: 'ft-10RCfqSvgyEcauomw7VpiYco', + hyperparams: { + n_epochs: 4, + batch_size: 3, + prompt_loss_weight: 0.01, + learning_rate_multiplier: 0.1 }, - 'organization_id': 'org-COOLORG', - 'model': 'curie', - 'training_files': [{ - 'object': 'file', - 'id': 'file-t3k1gVSQDHrfZnPckzftlZ4A', - 'purpose': 'fine-tune', - 'filename': 'dave-hal.jsonl', - 'bytes': 356, - 'created_at': 1684365950, - 'status': 'processed', - 'status_details': null + organization_id: 'org-COOLORG', + model: 'curie', + training_files: [{ + object: 'file', + id: 'file-t3k1gVSQDHrfZnPckzftlZ4A', + purpose: 'fine-tune', + filename: 'dave-hal.jsonl', + bytes: 356, + created_at: 1684365950, + status: 'processed', + status_details: null }], - 'validation_files': [], - 'result_files': [{ - 'object': 'file', - 'id': 'file-bJyf8TM0jeSZueBo4jpodZVQ', - 'purpose': 'fine-tune-results', - 'filename': 'compiled_results.csv', - 'bytes': 410, - 'created_at': 1684442697, - 'status': 'processed', - 'status_details': null + validation_files: [], + result_files: [{ + object: 'file', + id: 'file-bJyf8TM0jeSZueBo4jpodZVQ', + purpose: 'fine-tune-results', + filename: 'compiled_results.csv', + bytes: 410, + created_at: 1684442697, + status: 'processed', + status_details: null }], - 'created_at': 1684442489, - 'updated_at': 1684442697, - 'status': 'succeeded', - 'fine_tuned_model': 'curie:ft-foo:deleteme-2023-05-18-20-44-56', - 'events': [ + created_at: 1684442489, + updated_at: 1684442697, + status: 'succeeded', + fine_tuned_model: 'curie:ft-foo:deleteme-2023-05-18-20-44-56', + events: [ { - 'object': 'fine-tune-event', - 'level': 'info', - 'message': 'Created fine-tune: ft-10RCfqSvgyEcauomw7VpiYco', - 'created_at': 1684442489 + object: 'fine-tune-event', + level: 'info', + message: 'Created fine-tune: ft-10RCfqSvgyEcauomw7VpiYco', + created_at: 1684442489 }, { - 'object': 'fine-tune-event', - 'level': 'info', - 'message': 'Fine-tune costs $0.00', - 'created_at': 1684442612 + object: 'fine-tune-event', + level: 'info', + message: 'Fine-tune costs $0.00', + created_at: 1684442612 }, { - 'object': 'fine-tune-event', - 'level': 'info', - 'message': 'Fine-tune enqueued. Queue number: 0', - 'created_at': 1684442612 + object: 'fine-tune-event', + level: 'info', + message: 'Fine-tune enqueued. Queue number: 0', + created_at: 1684442612 }, { - 'object': 'fine-tune-event', - 'level': 'info', - 'message': 'Fine-tune started', - 'created_at': 1684442614 + object: 'fine-tune-event', + level: 'info', + message: 'Fine-tune started', + created_at: 1684442614 }, { - 'object': 'fine-tune-event', - 'level': 'info', - 'message': 'Completed epoch 1/4', - 'created_at': 1684442677 + object: 'fine-tune-event', + level: 'info', + message: 'Completed epoch 1/4', + created_at: 1684442677 }, { - 'object': 'fine-tune-event', - 'level': 'info', - 'message': 'Completed epoch 2/4', - 'created_at': 1684442677 + object: 'fine-tune-event', + level: 'info', + message: 'Completed epoch 2/4', + created_at: 1684442677 }, { - 'object': 'fine-tune-event', - 'level': 'info', - 'message': 'Completed epoch 3/4', - 'created_at': 1684442678 + object: 'fine-tune-event', + level: 'info', + message: 'Completed epoch 3/4', + created_at: 1684442678 }, { - 'object': 'fine-tune-event', - 'level': 'info', - 'message': 'Completed epoch 4/4', - 'created_at': 1684442679 + object: 'fine-tune-event', + level: 'info', + message: 'Completed epoch 4/4', + created_at: 1684442679 }, { - 'object': 'fine-tune-event', - 'level': 'info', - 'message': 'Uploaded model: curie:ft-foo:deleteme-2023-05-18-20-44-56', - 'created_at': 1684442696 + object: 'fine-tune-event', + level: 'info', + message: 'Uploaded model: curie:ft-foo:deleteme-2023-05-18-20-44-56', + created_at: 1684442696 }, { - 'object': 'fine-tune-event', - 'level': 'info', - 'message': 'Uploaded result file: file-bJyf8TM0jeSZueBo4jpodZVQ', - 'created_at': 1684442697 + object: 'fine-tune-event', + level: 'info', + message: 'Uploaded result file: file-bJyf8TM0jeSZueBo4jpodZVQ', + created_at: 1684442697 }, { - 'object': 'fine-tune-event', - 'level': 'info', - 'message': 'Fine-tune succeeded', - 'created_at': 1684442697 + object: 'fine-tune-event', + level: 'info', + message: 'Fine-tune succeeded', + created_at: 1684442697 } ] }, [ @@ -1180,43 +1180,43 @@ describe('Plugin', () => { scope = nock('https://api.openai.com:443') .get('/v1/fine-tunes') .reply(200, { - 'object': 'list', - 'data': [{ - 'object': 'fine-tune', - 'id': 'ft-10RCfqSvgyEcauomw7VpiYco', - 'hyperparams': { - 'n_epochs': 4, - 'batch_size': 3, - 'prompt_loss_weight': 0.01, - 'learning_rate_multiplier': 0.1 + object: 'list', + data: [{ + object: 'fine-tune', + id: 'ft-10RCfqSvgyEcauomw7VpiYco', + hyperparams: { + n_epochs: 4, + batch_size: 3, + prompt_loss_weight: 0.01, + learning_rate_multiplier: 0.1 }, - 'organization_id': 'org-COOLORG', - 'model': 'curie', - 'training_files': [{ - 'object': 'file', - 'id': 'file-t3k1gVSQDHrfZnPckzftlZ4A', - 'purpose': 'fine-tune', - 'filename': 'dave-hal.jsonl', - 'bytes': 356, - 'created_at': 1684365950, - 'status': 'processed', - 'status_details': null + organization_id: 'org-COOLORG', + model: 'curie', + training_files: [{ + object: 'file', + id: 'file-t3k1gVSQDHrfZnPckzftlZ4A', + purpose: 'fine-tune', + filename: 'dave-hal.jsonl', + bytes: 356, + created_at: 1684365950, + status: 'processed', + status_details: null }], - 'validation_files': [], - 'result_files': [{ - 'object': 'file', - 'id': 'file-bJyf8TM0jeSZueBo4jpodZVQ', - 'purpose': 'fine-tune-results', - 'filename': 'compiled_results.csv', - 'bytes': 410, - 'created_at': 1684442697, - 'status': 'processed', - 'status_details': null + validation_files: [], + result_files: [{ + object: 'file', + id: 'file-bJyf8TM0jeSZueBo4jpodZVQ', + purpose: 'fine-tune-results', + filename: 'compiled_results.csv', + bytes: 410, + created_at: 1684442697, + status: 'processed', + status_details: null }], - 'created_at': 1684442489, - 'updated_at': 1684442697, - 'status': 'succeeded', - 'fine_tuned_model': 'curie:ft-foo:deleteme-2023-05-18-20-44-56' + created_at: 1684442489, + updated_at: 1684442697, + status: 'succeeded', + fine_tuned_model: 'curie:ft-foo:deleteme-2023-05-18-20-44-56' }] }) }) @@ -1254,73 +1254,73 @@ describe('Plugin', () => { scope = nock('https://api.openai.com:443') .get('/v1/fine-tunes/ft-10RCfqSvgyEcauomw7VpiYco/events') .reply(200, { - 'object': 'list', - 'data': [ + object: 'list', + data: [ { - 'object': 'fine-tune-event', - 'level': 'info', - 'message': 'Created fine-tune: ft-10RCfqSvgyEcauomw7VpiYco', - 'created_at': 1684442489 + object: 'fine-tune-event', + level: 'info', + message: 'Created fine-tune: ft-10RCfqSvgyEcauomw7VpiYco', + created_at: 1684442489 }, { - 'object': 'fine-tune-event', - 'level': 'info', - 'message': 'Fine-tune costs $0.00', - 'created_at': 1684442612 + object: 'fine-tune-event', + level: 'info', + message: 'Fine-tune costs $0.00', + created_at: 1684442612 }, { - 'object': 'fine-tune-event', - 'level': 'info', - 'message': 'Fine-tune enqueued. Queue number: 0', - 'created_at': 1684442612 + object: 'fine-tune-event', + level: 'info', + message: 'Fine-tune enqueued. Queue number: 0', + created_at: 1684442612 }, { - 'object': 'fine-tune-event', - 'level': 'info', - 'message': 'Fine-tune started', - 'created_at': 1684442614 + object: 'fine-tune-event', + level: 'info', + message: 'Fine-tune started', + created_at: 1684442614 }, { - 'object': 'fine-tune-event', - 'level': 'info', - 'message': 'Completed epoch 1/4', - 'created_at': 1684442677 + object: 'fine-tune-event', + level: 'info', + message: 'Completed epoch 1/4', + created_at: 1684442677 }, { - 'object': 'fine-tune-event', - 'level': 'info', - 'message': 'Completed epoch 2/4', - 'created_at': 1684442677 + object: 'fine-tune-event', + level: 'info', + message: 'Completed epoch 2/4', + created_at: 1684442677 }, { - 'object': 'fine-tune-event', - 'level': 'info', - 'message': 'Completed epoch 3/4', - 'created_at': 1684442678 + object: 'fine-tune-event', + level: 'info', + message: 'Completed epoch 3/4', + created_at: 1684442678 }, { - 'object': 'fine-tune-event', - 'level': 'info', - 'message': 'Completed epoch 4/4', - 'created_at': 1684442679 + object: 'fine-tune-event', + level: 'info', + message: 'Completed epoch 4/4', + created_at: 1684442679 }, { - 'object': 'fine-tune-event', - 'level': 'info', - 'message': 'Uploaded model: curie:ft-foo:deleteme-2023-05-18-20-44-56', - 'created_at': 1684442696 + object: 'fine-tune-event', + level: 'info', + message: 'Uploaded model: curie:ft-foo:deleteme-2023-05-18-20-44-56', + created_at: 1684442696 }, { - 'object': 'fine-tune-event', - 'level': 'info', - 'message': 'Uploaded result file: file-bJyf8TM0jeSZueBo4jpodZVQ', - 'created_at': 1684442697 + object: 'fine-tune-event', + level: 'info', + message: 'Uploaded result file: file-bJyf8TM0jeSZueBo4jpodZVQ', + created_at: 1684442697 }, { - 'object': 'fine-tune-event', - 'level': 'info', - 'message': 'Fine-tune succeeded', - 'created_at': 1684442697 + object: 'fine-tune-event', + level: 'info', + message: 'Fine-tune succeeded', + created_at: 1684442697 } ] }, [ @@ -1367,9 +1367,9 @@ describe('Plugin', () => { scope = nock('https://api.openai.com:443') .delete('/v1/models/ft-10RCfqSvgyEcauomw7VpiYco') .reply(200, { // guessing on response format here since my key lacks permissions - 'object': 'model', - 'id': 'ft-10RCfqSvgyEcauomw7VpiYco', - 'deleted': true + object: 'model', + id: 'ft-10RCfqSvgyEcauomw7VpiYco', + deleted: true }, [ 'Date', 'Thu, 18 May 2023 22:59:08 GMT', 'Content-Type', 'application/json', @@ -1416,44 +1416,44 @@ describe('Plugin', () => { scope = nock('https://api.openai.com:443') .post('/v1/fine-tunes/ft-TVpNqwlvermMegfRVqSOyPyS/cancel') .reply(200, { - 'object': 'fine-tune', - 'id': 'ft-TVpNqwlvermMegfRVqSOyPyS', - 'hyperparams': { - 'n_epochs': 4, - 'batch_size': 3, - 'prompt_loss_weight': 0.01, - 'learning_rate_multiplier': 0.1 + object: 'fine-tune', + id: 'ft-TVpNqwlvermMegfRVqSOyPyS', + hyperparams: { + n_epochs: 4, + batch_size: 3, + prompt_loss_weight: 0.01, + learning_rate_multiplier: 0.1 }, - 'organization_id': 'org-COOLORG', - 'model': 'curie', - 'training_files': [{ - 'object': 'file', - 'id': 'file-t3k1gVSQDHrfZnPckzftlZ4A', - 'purpose': 'fine-tune', - 'filename': 'dave-hal.jsonl', - 'bytes': 356, - 'created_at': 1684365950, - 'status': 'processed', - 'status_details': null + organization_id: 'org-COOLORG', + model: 'curie', + training_files: [{ + object: 'file', + id: 'file-t3k1gVSQDHrfZnPckzftlZ4A', + purpose: 'fine-tune', + filename: 'dave-hal.jsonl', + bytes: 356, + created_at: 1684365950, + status: 'processed', + status_details: null }], - 'validation_files': [], - 'result_files': [], - 'created_at': 1684452102, - 'updated_at': 1684452103, - 'status': 'cancelled', - 'fine_tuned_model': 'idk', - 'events': [ + validation_files: [], + result_files: [], + created_at: 1684452102, + updated_at: 1684452103, + status: 'cancelled', + fine_tuned_model: 'idk', + events: [ { - 'object': 'fine-tune-event', - 'level': 'info', - 'message': 'Created fine-tune: ft-TVpNqwlvermMegfRVqSOyPyS', - 'created_at': 1684452102 + object: 'fine-tune-event', + level: 'info', + message: 'Created fine-tune: ft-TVpNqwlvermMegfRVqSOyPyS', + created_at: 1684452102 }, { - 'object': 'fine-tune-event', - 'level': 'info', - 'message': 'Fine-tune cancelled', - 'created_at': 1684452103 + object: 'fine-tune-event', + level: 'info', + message: 'Fine-tune cancelled', + created_at: 1684452103 } ] }, [ @@ -1515,23 +1515,23 @@ describe('Plugin', () => { scope = nock('https://api.openai.com:443') .post('/v1/moderations') .reply(200, { - 'id': 'modr-7HHZZZylF31ahuhmH279JrKbGTHCW', - 'model': 'text-moderation-001', - 'results': [{ - 'flagged': true, - 'categories': { - 'sexual': false, - 'hate': false, - 'violence': true, + id: 'modr-7HHZZZylF31ahuhmH279JrKbGTHCW', + model: 'text-moderation-001', + results: [{ + flagged: true, + categories: { + sexual: false, + hate: false, + violence: true, 'self-harm': false, 'sexual/minors': false, 'hate/threatening': false, 'violence/graphic': false }, - 'category_scores': { - 'sexual': 0.0018438849, - 'hate': 0.069274776, - 'violence': 0.74101615, + category_scores: { + sexual: 0.0018438849, + hate: 0.069274776, + violence: 0.74101615, 'self-harm': 0.008981651, 'sexual/minors': 0.00070737937, 'hate/threatening': 0.045174375, @@ -1617,10 +1617,10 @@ describe('Plugin', () => { scope = nock('https://api.openai.com:443') .post('/v1/images/generations') .reply(200, { - 'created': 1684270747, - 'data': [{ - 'url': 'https://oaidalleapiprodscus.blob.core.windows.net/private/org-COOLORG/user-FOO/img-foo.png', - 'b64_json': 'foobar===' + created: 1684270747, + data: [{ + url: 'https://oaidalleapiprodscus.blob.core.windows.net/private/org-COOLORG/user-FOO/img-foo.png', + b64_json: 'foobar===' }] }, [ 'Date', 'Tue, 16 May 2023 20:59:07 GMT', @@ -1699,7 +1699,7 @@ describe('Plugin', () => { expect(externalLoggerStub).to.have.been.calledWith({ status: 'info', message: 'sampled createImage', - prompt: [ 999, 888, 777, 666, 555 ] + prompt: [999, 888, 777, 666, 555] }) await checkTraces @@ -1725,7 +1725,7 @@ describe('Plugin', () => { expect(externalLoggerStub).to.have.been.calledWith({ status: 'info', message: 'sampled createImage', - prompt: [ 'foo', 'bar' ] + prompt: ['foo', 'bar'] }) await checkTraces @@ -1754,7 +1754,7 @@ describe('Plugin', () => { expect(externalLoggerStub).to.have.been.calledWith({ status: 'info', message: 'sampled createImage', - prompt: [ [ 111, 222, 333 ], [ 444, 555, 666 ] ] + prompt: [[111, 222, 333], [444, 555, 666]] }) await checkTraces @@ -1768,10 +1768,10 @@ describe('Plugin', () => { scope = nock('https://api.openai.com:443') .post('/v1/images/edits') .reply(200, { - 'created': 1684850118, - 'data': [{ - 'url': 'https://oaidalleapiprodscus.blob.core.windows.net/private/org-COOLORG/user-FOO/img-bar.png', - 'b64_json': 'fOoF0f=' + created: 1684850118, + data: [{ + url: 'https://oaidalleapiprodscus.blob.core.windows.net/private/org-COOLORG/user-FOO/img-bar.png', + b64_json: 'fOoF0f=' }] }, [ 'Date', 'Tue, 23 May 2023 13:55:18 GMT', @@ -1845,10 +1845,10 @@ describe('Plugin', () => { scope = nock('https://api.openai.com:443') .post('/v1/images/variations') .reply(200, { - 'created': 1684853320, - 'data': [{ - 'url': 'https://oaidalleapiprodscus.blob.core.windows.net/private/org-COOLORG/user-FOO/img-soup.png', - 'b64_json': 'foo=' + created: 1684853320, + data: [{ + url: 'https://oaidalleapiprodscus.blob.core.windows.net/private/org-COOLORG/user-FOO/img-soup.png', + b64_json: 'foo=' }] }, [ 'Date', 'Tue, 23 May 2023 14:48:40 GMT', @@ -1913,23 +1913,23 @@ describe('Plugin', () => { scope = nock('https://api.openai.com:443') .post('/v1/chat/completions') .reply(200, { - 'id': 'chatcmpl-7GaWqyMTD9BLmkmy8SxyjUGX3KSRN', - 'object': 'chat.completion', - 'created': 1684188020, - 'model': 'gpt-3.5-turbo-0301', - 'usage': { - 'prompt_tokens': 37, - 'completion_tokens': 10, - 'total_tokens': 47 + id: 'chatcmpl-7GaWqyMTD9BLmkmy8SxyjUGX3KSRN', + object: 'chat.completion', + created: 1684188020, + model: 'gpt-3.5-turbo-0301', + usage: { + prompt_tokens: 37, + completion_tokens: 10, + total_tokens: 47 }, - 'choices': [{ - 'message': { - 'role': 'assistant', - 'content': "In that case, it's best to avoid peanut", - 'name': 'hunter2' + choices: [{ + message: { + role: 'assistant', + content: "In that case, it's best to avoid peanut", + name: 'hunter2' }, - 'finish_reason': 'length', - 'index': 0 + finish_reason: 'length', + index: 0 }] }, [ 'Date', 'Mon, 15 May 2023 22:00:21 GMT', @@ -1991,19 +1991,19 @@ describe('Plugin', () => { model: 'gpt-3.5-turbo', messages: [ { - 'role': 'user', - 'content': 'Peanut Butter or Jelly?', - 'name': 'hunter2' + role: 'user', + content: 'Peanut Butter or Jelly?', + name: 'hunter2' }, { - 'role': 'assistant', - 'content': 'Are you allergic to peanuts?', - 'name': 'hal' + role: 'assistant', + content: 'Are you allergic to peanuts?', + name: 'hal' }, { - 'role': 'user', - 'content': 'Deathly allergic!', - 'name': 'hunter2' + role: 'user', + content: 'Deathly allergic!', + name: 'hunter2' } ], temperature: 1.001, @@ -2012,7 +2012,7 @@ describe('Plugin', () => { presence_penalty: -0.0001, frequency_penalty: 0.0001, logit_bias: { - '1234': -1 + 1234: -1 }, top_p: 4, n: 3, @@ -2078,23 +2078,23 @@ describe('Plugin', () => { scope = nock('https://api.openai.com:443') .post('/v1/audio/transcriptions') .reply(200, { - 'task': 'transcribe', - 'language': 'english', - 'duration': 2.19, - 'segments': [{ - 'id': 0, - 'seek': 0, - 'start': 0, - 'end': 2, - 'text': ' Hello, friend.', - 'tokens': [50364, 2425, 11, 1277, 13, 50464], - 'temperature': 0.5, - 'avg_logprob': -0.7777707236153739, - 'compression_ratio': 0.6363636363636364, - 'no_speech_prob': 0.043891049921512604, - 'transient': false + task: 'transcribe', + language: 'english', + duration: 2.19, + segments: [{ + id: 0, + seek: 0, + start: 0, + end: 2, + text: ' Hello, friend.', + tokens: [50364, 2425, 11, 1277, 13, 50464], + temperature: 0.5, + avg_logprob: -0.7777707236153739, + compression_ratio: 0.6363636363636364, + no_speech_prob: 0.043891049921512604, + transient: false }], - 'text': 'Hello, friend.' + text: 'Hello, friend.' }, [ 'Date', 'Fri, 19 May 2023 03:19:49 GMT', 'Content-Type', 'text/plain; charset=utf-8', @@ -2165,23 +2165,23 @@ describe('Plugin', () => { scope = nock('https://api.openai.com:443') .post('/v1/audio/translations') .reply(200, { - 'task': 'translate', - 'language': 'english', - 'duration': 1.74, - 'segments': [{ - 'id': 0, - 'seek': 0, - 'start': 0, - 'end': 3, - 'text': ' Guten Tag!', - 'tokens': [50364, 42833, 11204, 0, 50514], - 'temperature': 0.5, - 'avg_logprob': -0.5626437266667684, - 'compression_ratio': 0.5555555555555556, - 'no_speech_prob': 0.01843200996518135, - 'transient': false + task: 'translate', + language: 'english', + duration: 1.74, + segments: [{ + id: 0, + seek: 0, + start: 0, + end: 3, + text: ' Guten Tag!', + tokens: [50364, 42833, 11204, 0, 50514], + temperature: 0.5, + avg_logprob: -0.5626437266667684, + compression_ratio: 0.5555555555555556, + no_speech_prob: 0.01843200996518135, + transient: false }], - 'text': 'Guten Tag!' + text: 'Guten Tag!' }, [ 'Date', 'Fri, 19 May 2023 03:41:25 GMT', 'Content-Type', 'application/json', diff --git a/packages/datadog-plugin-openai/test/integration-test/client.spec.js b/packages/datadog-plugin-openai/test/integration-test/client.spec.js index c8b38afb994..7a106f8fc35 100644 --- a/packages/datadog-plugin-openai/test/integration-test/client.spec.js +++ b/packages/datadog-plugin-openai/test/integration-test/client.spec.js @@ -17,7 +17,7 @@ describe('esm', () => { before(async function () { this.timeout(20000) sandbox = await createSandbox([`'openai@${version}'`, 'nock'], false, [ - `./packages/datadog-plugin-openai/test/integration-test/*`]) + './packages/datadog-plugin-openai/test/integration-test/*']) }) after(async () => { diff --git a/packages/datadog-plugin-opensearch/test/integration-test/client.spec.js b/packages/datadog-plugin-opensearch/test/integration-test/client.spec.js index 626ed563fea..7121c2acf72 100644 --- a/packages/datadog-plugin-opensearch/test/integration-test/client.spec.js +++ b/packages/datadog-plugin-opensearch/test/integration-test/client.spec.js @@ -17,7 +17,7 @@ describe('esm', () => { before(async function () { this.timeout(20000) sandbox = await createSandbox([`'@opensearch-project/opensearch@${version}'`], false, [ - `./packages/datadog-plugin-opensearch/test/integration-test/*`]) + './packages/datadog-plugin-opensearch/test/integration-test/*']) }) after(async () => { diff --git a/packages/datadog-plugin-opensearch/test/naming.js b/packages/datadog-plugin-opensearch/test/naming.js index bd594c91383..72b158196a0 100644 --- a/packages/datadog-plugin-opensearch/test/naming.js +++ b/packages/datadog-plugin-opensearch/test/naming.js @@ -14,6 +14,6 @@ const rawExpectedSchema = { } module.exports = { - rawExpectedSchema: rawExpectedSchema, + rawExpectedSchema, expectedSchema: resolveNaming(rawExpectedSchema) } diff --git a/packages/datadog-plugin-oracledb/test/integration-test/client.spec.js b/packages/datadog-plugin-oracledb/test/integration-test/client.spec.js index cd34ed135b7..f486e69e1cd 100644 --- a/packages/datadog-plugin-oracledb/test/integration-test/client.spec.js +++ b/packages/datadog-plugin-oracledb/test/integration-test/client.spec.js @@ -17,7 +17,7 @@ describe('esm', () => { before(async function () { this.timeout(20000) sandbox = await createSandbox([`'oracledb@${version}'`], false, [ - `./packages/datadog-plugin-oracledb/test/integration-test/*`]) + './packages/datadog-plugin-oracledb/test/integration-test/*']) }) after(async () => { diff --git a/packages/datadog-plugin-oracledb/test/naming.js b/packages/datadog-plugin-oracledb/test/naming.js index 5bd78e51d4d..eaed0fa7516 100644 --- a/packages/datadog-plugin-oracledb/test/naming.js +++ b/packages/datadog-plugin-oracledb/test/naming.js @@ -14,6 +14,6 @@ const rawExpectedSchema = { } module.exports = { - rawExpectedSchema: rawExpectedSchema, + rawExpectedSchema, expectedSchema: resolveNaming(rawExpectedSchema) } diff --git a/packages/datadog-plugin-pg/test/index.spec.js b/packages/datadog-plugin-pg/test/index.spec.js index 542d449d492..0fba841b867 100644 --- a/packages/datadog-plugin-pg/test/index.spec.js +++ b/packages/datadog-plugin-pg/test/index.spec.js @@ -430,7 +430,7 @@ describe('Plugin', () => { if (clientDBM.queryQueue[0] !== undefined) { try { expect(clientDBM.queryQueue[0].text).to.equal( - `/*dddbs='~!%40%23%24%25%5E%26*()_%2B%7C%3F%3F%2F%3C%3E',dde='tester',` + + '/*dddbs=\'~!%40%23%24%25%5E%26*()_%2B%7C%3F%3F%2F%3C%3E\',dde=\'tester\',' + `ddps='test',ddpv='${ddpv}'*/ SELECT $1::text as message`) done() } catch (e) { @@ -619,7 +619,7 @@ describe('Plugin', () => { agent.use(traces => { expect(queryText).to.equal( `/*dddbs='post',dde='tester',ddps='test',ddpv='${ddpv}'` + - `*/ SELECT $1::text as message`) + '*/ SELECT $1::text as message') }).then(done, done) client.query(query, ['Hello world!'], (err) => { @@ -643,7 +643,7 @@ describe('Plugin', () => { agent.use(traces => { expect(queryText).to.equal( `/*dddbs='post',dde='tester',ddps='test',ddpv='${ddpv}'` + - `*/ SELECT $1::text as message`) + '*/ SELECT $1::text as message') }).then(done, done) client.query(query, ['Hello world!'], (err) => { @@ -677,7 +677,7 @@ describe('Plugin', () => { agent.use(traces => { expect(queryText).to.equal( `/*dddbs='post',dde='tester',ddps='test',ddpv='${ddpv}'` + - `*/ SELECT $1::text as greeting`) + '*/ SELECT $1::text as greeting') }).then(done, done) client.query(query, ['Goodbye'], (err) => { diff --git a/packages/datadog-plugin-pg/test/integration-test/client.spec.js b/packages/datadog-plugin-pg/test/integration-test/client.spec.js index 83542c39758..18e97dac50e 100644 --- a/packages/datadog-plugin-pg/test/integration-test/client.spec.js +++ b/packages/datadog-plugin-pg/test/integration-test/client.spec.js @@ -17,7 +17,7 @@ describe('esm', () => { before(async function () { this.timeout(20000) sandbox = await createSandbox([`'pg@${version}'`], false, [ - `./packages/datadog-plugin-pg/test/integration-test/*`]) + './packages/datadog-plugin-pg/test/integration-test/*']) }) after(async () => { diff --git a/packages/datadog-plugin-pg/test/naming.js b/packages/datadog-plugin-pg/test/naming.js index 5d7efe729eb..a961906a417 100644 --- a/packages/datadog-plugin-pg/test/naming.js +++ b/packages/datadog-plugin-pg/test/naming.js @@ -14,6 +14,6 @@ const rawExpectedSchema = { } module.exports = { - rawExpectedSchema: rawExpectedSchema, + rawExpectedSchema, expectedSchema: resolveNaming(rawExpectedSchema) } diff --git a/packages/datadog-plugin-pino/test/index.spec.js b/packages/datadog-plugin-pino/test/index.spec.js index a11c7abf6df..14708c6bf94 100644 --- a/packages/datadog-plugin-pino/test/index.spec.js +++ b/packages/datadog-plugin-pino/test/index.spec.js @@ -35,7 +35,7 @@ describe('Plugin', () => { if (semver.intersects(version, '>=8') && options.prettyPrint) { delete options.prettyPrint // deprecated - const pretty = require(`../../../versions/pino-pretty@8.0.0`).get() + const pretty = require('../../../versions/pino-pretty@8.0.0').get() stream = pretty().pipe(stream) } diff --git a/packages/datadog-plugin-pino/test/integration-test/client.spec.js b/packages/datadog-plugin-pino/test/integration-test/client.spec.js index 33cee141165..389b765eaa9 100644 --- a/packages/datadog-plugin-pino/test/integration-test/client.spec.js +++ b/packages/datadog-plugin-pino/test/integration-test/client.spec.js @@ -16,7 +16,7 @@ describe('esm', () => { before(async function () { this.timeout(20000) sandbox = await createSandbox([`'pino@${version}'`], - false, [`./packages/datadog-plugin-pino/test/integration-test/*`]) + false, ['./packages/datadog-plugin-pino/test/integration-test/*']) }) after(async () => { diff --git a/packages/datadog-plugin-redis/test/integration-test/client.spec.js b/packages/datadog-plugin-redis/test/integration-test/client.spec.js index 9c65daa604e..89836ba66d8 100644 --- a/packages/datadog-plugin-redis/test/integration-test/client.spec.js +++ b/packages/datadog-plugin-redis/test/integration-test/client.spec.js @@ -17,7 +17,7 @@ describe('esm', () => { before(async function () { this.timeout(20000) sandbox = await createSandbox([`'redis@${version}'`], false, [ - `./packages/datadog-plugin-redis/test/integration-test/*`]) + './packages/datadog-plugin-redis/test/integration-test/*']) }) after(async () => { diff --git a/packages/datadog-plugin-redis/test/naming.js b/packages/datadog-plugin-redis/test/naming.js index 2df9f5056d8..1ed3f17e428 100644 --- a/packages/datadog-plugin-redis/test/naming.js +++ b/packages/datadog-plugin-redis/test/naming.js @@ -14,6 +14,6 @@ const rawExpectedSchema = { } module.exports = { - rawExpectedSchema: rawExpectedSchema, + rawExpectedSchema, expectedSchema: resolveNaming(rawExpectedSchema) } diff --git a/packages/datadog-plugin-restify/test/integration-test/client.spec.js b/packages/datadog-plugin-restify/test/integration-test/client.spec.js index c7d09d33a68..674dbc9bc08 100644 --- a/packages/datadog-plugin-restify/test/integration-test/client.spec.js +++ b/packages/datadog-plugin-restify/test/integration-test/client.spec.js @@ -19,7 +19,7 @@ describe('esm', () => { before(async function () { this.timeout(20000) sandbox = await createSandbox([`'restify@${version}'`], - false, [`./packages/datadog-plugin-restify/test/integration-test/*`]) + false, ['./packages/datadog-plugin-restify/test/integration-test/*']) }) after(async () => { diff --git a/packages/datadog-plugin-rhea/src/consumer.js b/packages/datadog-plugin-rhea/src/consumer.js index 73c83be1f44..226834885be 100644 --- a/packages/datadog-plugin-rhea/src/consumer.js +++ b/packages/datadog-plugin-rhea/src/consumer.js @@ -26,7 +26,7 @@ class RheaConsumerPlugin extends ConsumerPlugin { resource: name, type: 'worker', meta: { - 'component': 'rhea', + component: 'rhea', 'amqp.link.source.address': name, 'amqp.link.role': 'receiver' } diff --git a/packages/datadog-plugin-rhea/src/producer.js b/packages/datadog-plugin-rhea/src/producer.js index 991f64371ab..8f2116d3d75 100644 --- a/packages/datadog-plugin-rhea/src/producer.js +++ b/packages/datadog-plugin-rhea/src/producer.js @@ -19,7 +19,7 @@ class RheaProducerPlugin extends ProducerPlugin { this.startSpan({ resource: name, meta: { - 'component': 'rhea', + component: 'rhea', 'amqp.link.target.address': name, 'amqp.link.role': 'sender', 'out.host': host, diff --git a/packages/datadog-plugin-rhea/test/index.spec.js b/packages/datadog-plugin-rhea/test/index.spec.js index c7814cbcba2..c72d875af78 100644 --- a/packages/datadog-plugin-rhea/test/index.spec.js +++ b/packages/datadog-plugin-rhea/test/index.spec.js @@ -151,7 +151,7 @@ describe('Plugin', () => { 'amqp.link.role': 'sender', 'amqp.delivery.state': 'accepted', 'out.host': 'localhost', - 'component': 'rhea' + component: 'rhea' }) expect(span.metrics).to.include({ 'network.destination.port': 5673 @@ -205,7 +205,7 @@ describe('Plugin', () => { 'span.kind': 'consumer', 'amqp.link.source.address': 'amq.topic', 'amqp.link.role': 'receiver', - 'component': 'rhea' + component: 'rhea' }) }) .then(done, done) @@ -442,7 +442,7 @@ describe('Plugin', () => { [ERROR_MESSAGE]: 'this is an error', [ERROR_TYPE]: 'Error', [ERROR_STACK]: error.stack, - 'component': 'rhea' + component: 'rhea' }) Session.prototype.on_transfer = onTransfer }).then(done, done) @@ -650,7 +650,7 @@ describe('Plugin', () => { [ERROR_TYPE]: 'Error', [ERROR_MESSAGE]: 'fake protocol error', [ERROR_STACK]: err.stack, - 'component': 'rhea' + component: 'rhea' }) expect(span.metrics).to.include({ 'network.destination.port': expectedServerPort @@ -682,7 +682,7 @@ describe('Plugin', () => { [ERROR_TYPE]: 'Error', [ERROR_MESSAGE]: 'fake protocol error', [ERROR_STACK]: err.stack, - 'component': 'rhea' + component: 'rhea' }) }).then(done, done) client.on('message', msg => { @@ -715,7 +715,7 @@ function expectReceiving (agent, expectedSchema, deliveryState, topic) { 'span.kind': 'consumer', 'amqp.link.source.address': topic, 'amqp.link.role': 'receiver', - 'component': 'rhea' + component: 'rhea' } if (deliveryState) { expectedMeta['amqp.delivery.state'] = deliveryState @@ -740,7 +740,7 @@ function expectSending (agent, expectedSchema, deliveryState, topic) { 'span.kind': 'producer', 'amqp.link.target.address': topic, 'amqp.link.role': 'sender', - 'component': 'rhea' + component: 'rhea' } if (deliveryState) { expectedMeta['amqp.delivery.state'] = deliveryState diff --git a/packages/datadog-plugin-rhea/test/integration-test/client.spec.js b/packages/datadog-plugin-rhea/test/integration-test/client.spec.js index bf3485b45f8..cbcae01ecba 100644 --- a/packages/datadog-plugin-rhea/test/integration-test/client.spec.js +++ b/packages/datadog-plugin-rhea/test/integration-test/client.spec.js @@ -17,7 +17,7 @@ describe('esm', () => { before(async function () { this.timeout(20000) sandbox = await createSandbox([`'rhea@${version}'`], false, [ - `./packages/datadog-plugin-rhea/test/integration-test/*`]) + './packages/datadog-plugin-rhea/test/integration-test/*']) }) after(async () => { diff --git a/packages/datadog-plugin-rhea/test/naming.js b/packages/datadog-plugin-rhea/test/naming.js index ea505cec556..f4e4508e8a7 100644 --- a/packages/datadog-plugin-rhea/test/naming.js +++ b/packages/datadog-plugin-rhea/test/naming.js @@ -24,6 +24,6 @@ const rawExpectedSchema = { } module.exports = { - rawExpectedSchema: rawExpectedSchema, + rawExpectedSchema, expectedSchema: resolveNaming(rawExpectedSchema) } diff --git a/packages/datadog-plugin-router/src/index.js b/packages/datadog-plugin-router/src/index.js index 682a4301580..439f2d08332 100644 --- a/packages/datadog-plugin-router/src/index.js +++ b/packages/datadog-plugin-router/src/index.js @@ -71,7 +71,7 @@ class RouterPlugin extends WebPlugin { span.setTag('error', error) }) - this.addSub(`apm:http:server:request:finish`, ({ req }) => { + this.addSub('apm:http:server:request:finish', ({ req }) => { const context = this._contexts.get(req) if (!context) return diff --git a/packages/datadog-plugin-router/test/index.spec.js b/packages/datadog-plugin-router/test/index.spec.js index 894dacc3883..3c8e8ee68f3 100644 --- a/packages/datadog-plugin-router/test/index.spec.js +++ b/packages/datadog-plugin-router/test/index.spec.js @@ -146,6 +146,7 @@ describe('Plugin', () => { } }, { rejectFirst: true }) + // eslint-disable-next-line n/handle-callback-err const httpd = server(router, (req, res) => err => res.end()).listen(port, 'localhost') await once(httpd, 'listening') const reqPromise = axios.get(`http://localhost:${port}/foo`) diff --git a/packages/datadog-plugin-router/test/integration-test/client.spec.js b/packages/datadog-plugin-router/test/integration-test/client.spec.js index 7982db2f7c1..3b32836e64c 100644 --- a/packages/datadog-plugin-router/test/integration-test/client.spec.js +++ b/packages/datadog-plugin-router/test/integration-test/client.spec.js @@ -18,7 +18,7 @@ describe('esm', () => { before(async function () { this.timeout(20000) sandbox = await createSandbox([`'router@${version}'`] - , false, [`./packages/datadog-plugin-router/test/integration-test/*`]) + , false, ['./packages/datadog-plugin-router/test/integration-test/*']) }) after(async () => { diff --git a/packages/datadog-plugin-sharedb/test/integration-test/client.spec.js b/packages/datadog-plugin-sharedb/test/integration-test/client.spec.js index 04cfd2b3f10..9d2aa161ca8 100644 --- a/packages/datadog-plugin-sharedb/test/integration-test/client.spec.js +++ b/packages/datadog-plugin-sharedb/test/integration-test/client.spec.js @@ -18,7 +18,7 @@ describe('esm', () => { before(async function () { this.timeout(20000) sandbox = await createSandbox([`'sharedb@${version}'`], false, [ - `./packages/datadog-plugin-sharedb/test/integration-test/*`]) + './packages/datadog-plugin-sharedb/test/integration-test/*']) }) after(async () => { diff --git a/packages/datadog-plugin-tedious/src/index.js b/packages/datadog-plugin-tedious/src/index.js index 56df5e453ba..97eab3617dc 100644 --- a/packages/datadog-plugin-tedious/src/index.js +++ b/packages/datadog-plugin-tedious/src/index.js @@ -16,7 +16,7 @@ class TediousPlugin extends DatabasePlugin { kind: 'client', meta: { 'db.type': 'mssql', - 'component': 'tedious', + component: 'tedious', 'out.host': connectionConfig.server, [CLIENT_PORT_KEY]: connectionConfig.options.port, 'db.user': connectionConfig.userName || connectionConfig.authentication.options.userName, diff --git a/packages/datadog-plugin-tedious/test/integration-test/client.spec.js b/packages/datadog-plugin-tedious/test/integration-test/client.spec.js index 271135800c3..aa32944f541 100644 --- a/packages/datadog-plugin-tedious/test/integration-test/client.spec.js +++ b/packages/datadog-plugin-tedious/test/integration-test/client.spec.js @@ -24,7 +24,7 @@ describe('esm', () => { before(async function () { this.timeout(20000) sandbox = await createSandbox([`'tedious@${version}'`], false, [ - `./packages/datadog-plugin-tedious/test/integration-test/*`]) + './packages/datadog-plugin-tedious/test/integration-test/*']) }) after(async () => { diff --git a/packages/datadog-plugin-tedious/test/naming.js b/packages/datadog-plugin-tedious/test/naming.js index 3473f6e86c9..da01aad5a8f 100644 --- a/packages/datadog-plugin-tedious/test/naming.js +++ b/packages/datadog-plugin-tedious/test/naming.js @@ -14,6 +14,6 @@ const rawExpectedSchema = { } module.exports = { - rawExpectedSchema: rawExpectedSchema, + rawExpectedSchema, expectedSchema: resolveNaming(rawExpectedSchema) } diff --git a/packages/datadog-plugin-winston/test/integration-test/client.spec.js b/packages/datadog-plugin-winston/test/integration-test/client.spec.js index 505280d836d..cb94108145a 100644 --- a/packages/datadog-plugin-winston/test/integration-test/client.spec.js +++ b/packages/datadog-plugin-winston/test/integration-test/client.spec.js @@ -17,7 +17,7 @@ describe('esm', () => { before(async function () { this.timeout(50000) sandbox = await createSandbox([`'winston@${version}'`] - , false, [`./packages/datadog-plugin-winston/test/integration-test/*`]) + , false, ['./packages/datadog-plugin-winston/test/integration-test/*']) }) after(async function () { diff --git a/packages/dd-trace/src/appsec/blocking.js b/packages/dd-trace/src/appsec/blocking.js index 44ba3e0a4f2..65812357614 100644 --- a/packages/dd-trace/src/appsec/blocking.js +++ b/packages/dd-trace/src/appsec/blocking.js @@ -28,7 +28,7 @@ function getBlockWithRedirectData (rootSpan) { statusCode = 303 } const headers = { - 'Location': blockingConfiguration.parameters.location + Location: blockingConfiguration.parameters.location } rootSpan.addTags({ diff --git a/packages/dd-trace/src/appsec/iast/analyzers/analyzers.js b/packages/dd-trace/src/appsec/iast/analyzers/analyzers.js index 31dd4baf611..b04d499edab 100644 --- a/packages/dd-trace/src/appsec/iast/analyzers/analyzers.js +++ b/packages/dd-trace/src/appsec/iast/analyzers/analyzers.js @@ -1,21 +1,21 @@ 'use strict' module.exports = { - 'COMMAND_INJECTION_ANALYZER': require('./command-injection-analyzer'), - 'HARCODED_SECRET_ANALYZER': require('./hardcoded-secret-analyzer'), - 'HEADER_INJECTION_ANALYZER': require('./header-injection-analyzer'), - 'HSTS_HEADER_MISSING_ANALYZER': require('./hsts-header-missing-analyzer'), - 'INSECURE_COOKIE_ANALYZER': require('./insecure-cookie-analyzer'), - 'LDAP_ANALYZER': require('./ldap-injection-analyzer'), - 'NO_HTTPONLY_COOKIE_ANALYZER': require('./no-httponly-cookie-analyzer'), - 'NO_SAMESITE_COOKIE_ANALYZER': require('./no-samesite-cookie-analyzer'), - 'NOSQL_MONGODB_INJECTION': require('./nosql-injection-mongodb-analyzer'), - 'PATH_TRAVERSAL_ANALYZER': require('./path-traversal-analyzer'), - 'SQL_INJECTION_ANALYZER': require('./sql-injection-analyzer'), - 'SSRF': require('./ssrf-analyzer'), - 'UNVALIDATED_REDIRECT_ANALYZER': require('./unvalidated-redirect-analyzer'), - 'WEAK_CIPHER_ANALYZER': require('./weak-cipher-analyzer'), - 'WEAK_HASH_ANALYZER': require('./weak-hash-analyzer'), - 'WEAK_RANDOMNESS_ANALYZER': require('./weak-randomness-analyzer'), - 'XCONTENTTYPE_HEADER_MISSING_ANALYZER': require('./xcontenttype-header-missing-analyzer') + COMMAND_INJECTION_ANALYZER: require('./command-injection-analyzer'), + HARCODED_SECRET_ANALYZER: require('./hardcoded-secret-analyzer'), + HEADER_INJECTION_ANALYZER: require('./header-injection-analyzer'), + HSTS_HEADER_MISSING_ANALYZER: require('./hsts-header-missing-analyzer'), + INSECURE_COOKIE_ANALYZER: require('./insecure-cookie-analyzer'), + LDAP_ANALYZER: require('./ldap-injection-analyzer'), + NO_HTTPONLY_COOKIE_ANALYZER: require('./no-httponly-cookie-analyzer'), + NO_SAMESITE_COOKIE_ANALYZER: require('./no-samesite-cookie-analyzer'), + NOSQL_MONGODB_INJECTION: require('./nosql-injection-mongodb-analyzer'), + PATH_TRAVERSAL_ANALYZER: require('./path-traversal-analyzer'), + SQL_INJECTION_ANALYZER: require('./sql-injection-analyzer'), + SSRF: require('./ssrf-analyzer'), + UNVALIDATED_REDIRECT_ANALYZER: require('./unvalidated-redirect-analyzer'), + WEAK_CIPHER_ANALYZER: require('./weak-cipher-analyzer'), + WEAK_HASH_ANALYZER: require('./weak-hash-analyzer'), + WEAK_RANDOMNESS_ANALYZER: require('./weak-randomness-analyzer'), + XCONTENTTYPE_HEADER_MISSING_ANALYZER: require('./xcontenttype-header-missing-analyzer') } diff --git a/packages/dd-trace/src/appsec/iast/analyzers/cookie-analyzer.js b/packages/dd-trace/src/appsec/iast/analyzers/cookie-analyzer.js index 413653a7af2..e82fe65ef74 100644 --- a/packages/dd-trace/src/appsec/iast/analyzers/cookie-analyzer.js +++ b/packages/dd-trace/src/appsec/iast/analyzers/cookie-analyzer.js @@ -34,6 +34,7 @@ class CookieAnalyzer extends Analyzer { _getExcludedPaths () { return EXCLUDED_PATHS } + _checkOCE (context, value) { if (value && value.location) { return true diff --git a/packages/dd-trace/src/appsec/iast/analyzers/hardcoded-secrets-rules.js b/packages/dd-trace/src/appsec/iast/analyzers/hardcoded-secrets-rules.js index b6069585e5c..0e4641b29ed 100644 --- a/packages/dd-trace/src/appsec/iast/analyzers/hardcoded-secrets-rules.js +++ b/packages/dd-trace/src/appsec/iast/analyzers/hardcoded-secrets-rules.js @@ -3,267 +3,267 @@ module.exports = [ { - 'id': 'adobe-client-secret', - 'regex': /\b((p8e-)[a-z0-9]{32})(?:['"\s\x60;]|$)/i + id: 'adobe-client-secret', + regex: /\b((p8e-)[a-z0-9]{32})(?:['"\s\x60;]|$)/i }, { - 'id': 'age-secret-key', - 'regex': /AGE-SECRET-KEY-1[QPZRY9X8GF2TVDW0S3JN54KHCE6MUA7L]{58}/ + id: 'age-secret-key', + regex: /AGE-SECRET-KEY-1[QPZRY9X8GF2TVDW0S3JN54KHCE6MUA7L]{58}/ }, { - 'id': 'alibaba-access-key-id', - 'regex': /\b((LTAI)[a-z0-9]{20})(?:['"\s\x60;]|$)/i + id: 'alibaba-access-key-id', + regex: /\b((LTAI)[a-z0-9]{20})(?:['"\s\x60;]|$)/i }, { - 'id': 'authress-service-client-access-key', - 'regex': /\b((?:sc|ext|scauth|authress)_[a-z0-9]{5,30}\.[a-z0-9]{4,6}\.acc[_-][a-z0-9-]{10,32}\.[a-z0-9+/_=-]{30,120})(?:['"\s\x60;]|$)/i + id: 'authress-service-client-access-key', + regex: /\b((?:sc|ext|scauth|authress)_[a-z0-9]{5,30}\.[a-z0-9]{4,6}\.acc[_-][a-z0-9-]{10,32}\.[a-z0-9+/_=-]{30,120})(?:['"\s\x60;]|$)/i }, { - 'id': 'aws-access-token', - 'regex': /\b((A3T[A-Z0-9]|AKIA|AGPA|AIDA|AROA|AIPA|ANPA|ANVA|ASIA)[A-Z0-9]{16})(?:['"\s\x60;]|$)/ + id: 'aws-access-token', + regex: /\b((A3T[A-Z0-9]|AKIA|AGPA|AIDA|AROA|AIPA|ANPA|ANVA|ASIA)[A-Z0-9]{16})(?:['"\s\x60;]|$)/ }, { - 'id': 'clojars-api-token', - 'regex': /(CLOJARS_)[a-z0-9]{60}/i + id: 'clojars-api-token', + regex: /(CLOJARS_)[a-z0-9]{60}/i }, { - 'id': 'databricks-api-token', - 'regex': /\b(dapi[a-h0-9]{32})(?:['"\s\x60;]|$)/i + id: 'databricks-api-token', + regex: /\b(dapi[a-h0-9]{32})(?:['"\s\x60;]|$)/i }, { - 'id': 'digitalocean-access-token', - 'regex': /\b(doo_v1_[a-f0-9]{64})(?:['"\s\x60;]|$)/i + id: 'digitalocean-access-token', + regex: /\b(doo_v1_[a-f0-9]{64})(?:['"\s\x60;]|$)/i }, { - 'id': 'digitalocean-pat', - 'regex': /\b(dop_v1_[a-f0-9]{64})(?:['"\s\x60;]|$)/i + id: 'digitalocean-pat', + regex: /\b(dop_v1_[a-f0-9]{64})(?:['"\s\x60;]|$)/i }, { - 'id': 'digitalocean-refresh-token', - 'regex': /\b(dor_v1_[a-f0-9]{64})(?:['"\s\x60;]|$)/i + id: 'digitalocean-refresh-token', + regex: /\b(dor_v1_[a-f0-9]{64})(?:['"\s\x60;]|$)/i }, { - 'id': 'doppler-api-token', - 'regex': /(dp\.pt\.)[a-z0-9]{43}/i + id: 'doppler-api-token', + regex: /(dp\.pt\.)[a-z0-9]{43}/i }, { - 'id': 'duffel-api-token', - 'regex': /duffel_(test|live)_[a-z0-9_\-=]{43}/i + id: 'duffel-api-token', + regex: /duffel_(test|live)_[a-z0-9_\-=]{43}/i }, { - 'id': 'dynatrace-api-token', - 'regex': /dt0c01\.[a-z0-9]{24}\.[a-z0-9]{64}/i + id: 'dynatrace-api-token', + regex: /dt0c01\.[a-z0-9]{24}\.[a-z0-9]{64}/i }, { - 'id': 'easypost-api-token', - 'regex': /\bEZAK[a-z0-9]{54}/i + id: 'easypost-api-token', + regex: /\bEZAK[a-z0-9]{54}/i }, { - 'id': 'flutterwave-public-key', - 'regex': /FLWPUBK_TEST-[a-h0-9]{32}-X/i + id: 'flutterwave-public-key', + regex: /FLWPUBK_TEST-[a-h0-9]{32}-X/i }, { - 'id': 'frameio-api-token', - 'regex': /fio-u-[a-z0-9\-_=]{64}/i + id: 'frameio-api-token', + regex: /fio-u-[a-z0-9\-_=]{64}/i }, { - 'id': 'gcp-api-key', - 'regex': /\b(AIza[0-9a-z\-_]{35})(?:['"\s\x60;]|$)/i + id: 'gcp-api-key', + regex: /\b(AIza[0-9a-z\-_]{35})(?:['"\s\x60;]|$)/i }, { - 'id': 'github-app-token', - 'regex': /(ghu|ghs)_[0-9a-zA-Z]{36}/ + id: 'github-app-token', + regex: /(ghu|ghs)_[0-9a-zA-Z]{36}/ }, { - 'id': 'github-fine-grained-pat', - 'regex': /github_pat_[0-9a-zA-Z_]{82}/ + id: 'github-fine-grained-pat', + regex: /github_pat_[0-9a-zA-Z_]{82}/ }, { - 'id': 'github-oauth', - 'regex': /gho_[0-9a-zA-Z]{36}/ + id: 'github-oauth', + regex: /gho_[0-9a-zA-Z]{36}/ }, { - 'id': 'github-pat', - 'regex': /ghp_[0-9a-zA-Z]{36}/ + id: 'github-pat', + regex: /ghp_[0-9a-zA-Z]{36}/ }, { - 'id': 'gitlab-pat', - 'regex': /glpat-[0-9a-zA-Z\-_]{20}/ + id: 'gitlab-pat', + regex: /glpat-[0-9a-zA-Z\-_]{20}/ }, { - 'id': 'gitlab-ptt', - 'regex': /glptt-[0-9a-f]{40}/ + id: 'gitlab-ptt', + regex: /glptt-[0-9a-f]{40}/ }, { - 'id': 'gitlab-rrt', - 'regex': /GR1348941[0-9a-zA-Z\-_]{20}/ + id: 'gitlab-rrt', + regex: /GR1348941[0-9a-zA-Z\-_]{20}/ }, { - 'id': 'grafana-api-key', - 'regex': /\b(eyJrIjoi[a-z0-9]{70,400}={0,2})(?:['"\s\x60;]|$)/i + id: 'grafana-api-key', + regex: /\b(eyJrIjoi[a-z0-9]{70,400}={0,2})(?:['"\s\x60;]|$)/i }, { - 'id': 'grafana-cloud-api-token', - 'regex': /\b(glc_[a-z0-9+/]{32,400}={0,2})(?:['"\s\x60;]|$)/i + id: 'grafana-cloud-api-token', + regex: /\b(glc_[a-z0-9+/]{32,400}={0,2})(?:['"\s\x60;]|$)/i }, { - 'id': 'grafana-service-account-token', - 'regex': /\b(glsa_[a-z0-9]{32}_[a-f0-9]{8})(?:['"\s\x60;]|$)/i + id: 'grafana-service-account-token', + regex: /\b(glsa_[a-z0-9]{32}_[a-f0-9]{8})(?:['"\s\x60;]|$)/i }, { - 'id': 'hashicorp-tf-api-token', - 'regex': /[a-z0-9]{14}\.atlasv1\.[a-z0-9\-_=]{60,70}/i + id: 'hashicorp-tf-api-token', + regex: /[a-z0-9]{14}\.atlasv1\.[a-z0-9\-_=]{60,70}/i }, { - 'id': 'jwt', - 'regex': /\b(ey[a-zA-Z0-9]{17,}\.ey[a-zA-Z0-9/_-]{17,}\.(?:[a-zA-Z0-9/_-]{10,}={0,2})?)(?:['"\s\x60;]|$)/ + id: 'jwt', + regex: /\b(ey[a-zA-Z0-9]{17,}\.ey[a-zA-Z0-9/_-]{17,}\.(?:[a-zA-Z0-9/_-]{10,}={0,2})?)(?:['"\s\x60;]|$)/ }, { - 'id': 'linear-api-key', - 'regex': /lin_api_[a-z0-9]{40}/i + id: 'linear-api-key', + regex: /lin_api_[a-z0-9]{40}/i }, { - 'id': 'npm-access-token', - 'regex': /\b(npm_[a-z0-9]{36})(?:['"\s\x60;]|$)/i + id: 'npm-access-token', + regex: /\b(npm_[a-z0-9]{36})(?:['"\s\x60;]|$)/i }, { - 'id': 'openai-api-key', - 'regex': /\b(sk-[a-z0-9]{20}T3BlbkFJ[a-z0-9]{20})(?:['"\s\x60;]|$)/i + id: 'openai-api-key', + regex: /\b(sk-[a-z0-9]{20}T3BlbkFJ[a-z0-9]{20})(?:['"\s\x60;]|$)/i }, { - 'id': 'planetscale-api-token', - 'regex': /\b(pscale_tkn_[a-z0-9=\-_.]{32,64})(?:['"\s\x60;]|$)/i + id: 'planetscale-api-token', + regex: /\b(pscale_tkn_[a-z0-9=\-_.]{32,64})(?:['"\s\x60;]|$)/i }, { - 'id': 'planetscale-oauth-token', - 'regex': /\b(pscale_oauth_[a-z0-9=\-_.]{32,64})(?:['"\s\x60;]|$)/i + id: 'planetscale-oauth-token', + regex: /\b(pscale_oauth_[a-z0-9=\-_.]{32,64})(?:['"\s\x60;]|$)/i }, { - 'id': 'planetscale-password', - 'regex': /\b(pscale_pw_[a-z0-9=\-_.]{32,64})(?:['"\s\x60;]|$)/i + id: 'planetscale-password', + regex: /\b(pscale_pw_[a-z0-9=\-_.]{32,64})(?:['"\s\x60;]|$)/i }, { - 'id': 'postman-api-token', - 'regex': /\b(PMAK-[a-f0-9]{24}-[a-f0-9]{34})(?:['"\s\x60;]|$)/i + id: 'postman-api-token', + regex: /\b(PMAK-[a-f0-9]{24}-[a-f0-9]{34})(?:['"\s\x60;]|$)/i }, { - 'id': 'prefect-api-token', - 'regex': /\b(pnu_[a-z0-9]{36})(?:['"\s\x60;]|$)/i + id: 'prefect-api-token', + regex: /\b(pnu_[a-z0-9]{36})(?:['"\s\x60;]|$)/i }, { - 'id': 'private-key', - 'regex': /-----BEGIN[ A-Z0-9_-]{0,100}PRIVATE KEY( BLOCK)?-----[\s\S]*KEY( BLOCK)?----/i + id: 'private-key', + regex: /-----BEGIN[ A-Z0-9_-]{0,100}PRIVATE KEY( BLOCK)?-----[\s\S]*KEY( BLOCK)?----/i }, { - 'id': 'pulumi-api-token', - 'regex': /\b(pul-[a-f0-9]{40})(?:['"\s\x60;]|$)/i + id: 'pulumi-api-token', + regex: /\b(pul-[a-f0-9]{40})(?:['"\s\x60;]|$)/i }, { - 'id': 'pypi-upload-token', - 'regex': /pypi-AgEIcHlwaS5vcmc[A-Za-z0-9\-_]{50,1000}/ + id: 'pypi-upload-token', + regex: /pypi-AgEIcHlwaS5vcmc[A-Za-z0-9\-_]{50,1000}/ }, { - 'id': 'readme-api-token', - 'regex': /\b(rdme_[a-z0-9]{70})(?:['"\s\x60;]|$)/i + id: 'readme-api-token', + regex: /\b(rdme_[a-z0-9]{70})(?:['"\s\x60;]|$)/i }, { - 'id': 'rubygems-api-token', - 'regex': /\b(rubygems_[a-f0-9]{48})(?:['"\s\x60;]|$)/i + id: 'rubygems-api-token', + regex: /\b(rubygems_[a-f0-9]{48})(?:['"\s\x60;]|$)/i }, { - 'id': 'scalingo-api-token', - 'regex': /tk-us-[a-zA-Z0-9-_]{48}/ + id: 'scalingo-api-token', + regex: /tk-us-[a-zA-Z0-9-_]{48}/ }, { - 'id': 'sendgrid-api-token', - 'regex': /\b(SG\.[a-z0-9=_\-.]{66})(?:['"\s\x60;]|$)/i + id: 'sendgrid-api-token', + regex: /\b(SG\.[a-z0-9=_\-.]{66})(?:['"\s\x60;]|$)/i }, { - 'id': 'sendinblue-api-token', - 'regex': /\b(xkeysib-[a-f0-9]{64}-[a-z0-9]{16})(?:['"\s\x60;]|$)/i + id: 'sendinblue-api-token', + regex: /\b(xkeysib-[a-f0-9]{64}-[a-z0-9]{16})(?:['"\s\x60;]|$)/i }, { - 'id': 'shippo-api-token', - 'regex': /\b(shippo_(live|test)_[a-f0-9]{40})(?:['"\s\x60;]|$)/i + id: 'shippo-api-token', + regex: /\b(shippo_(live|test)_[a-f0-9]{40})(?:['"\s\x60;]|$)/i }, { - 'id': 'shopify-access-token', - 'regex': /shpat_[a-fA-F0-9]{32}/ + id: 'shopify-access-token', + regex: /shpat_[a-fA-F0-9]{32}/ }, { - 'id': 'shopify-custom-access-token', - 'regex': /shpca_[a-fA-F0-9]{32}/ + id: 'shopify-custom-access-token', + regex: /shpca_[a-fA-F0-9]{32}/ }, { - 'id': 'shopify-private-app-access-token', - 'regex': /shppa_[a-fA-F0-9]{32}/ + id: 'shopify-private-app-access-token', + regex: /shppa_[a-fA-F0-9]{32}/ }, { - 'id': 'shopify-shared-secret', - 'regex': /shpss_[a-fA-F0-9]{32}/ + id: 'shopify-shared-secret', + regex: /shpss_[a-fA-F0-9]{32}/ }, { - 'id': 'slack-app-token', - 'regex': /(xapp-\d-[A-Z0-9]+-\d+-[a-z0-9]+)/i + id: 'slack-app-token', + regex: /(xapp-\d-[A-Z0-9]+-\d+-[a-z0-9]+)/i }, { - 'id': 'slack-bot-token', - 'regex': /(xoxb-[0-9]{10,13}-[0-9]{10,13}[a-zA-Z0-9-]*)/ + id: 'slack-bot-token', + regex: /(xoxb-[0-9]{10,13}-[0-9]{10,13}[a-zA-Z0-9-]*)/ }, { - 'id': 'slack-config-access-token', - 'regex': /(xoxe.xox[bp]-\d-[A-Z0-9]{163,166})/i + id: 'slack-config-access-token', + regex: /(xoxe.xox[bp]-\d-[A-Z0-9]{163,166})/i }, { - 'id': 'slack-config-refresh-token', - 'regex': /(xoxe-\d-[A-Z0-9]{146})/i + id: 'slack-config-refresh-token', + regex: /(xoxe-\d-[A-Z0-9]{146})/i }, { - 'id': 'slack-legacy-bot-token', - 'regex': /(xoxb-[0-9]{8,14}-[a-zA-Z0-9]{18,26})/ + id: 'slack-legacy-bot-token', + regex: /(xoxb-[0-9]{8,14}-[a-zA-Z0-9]{18,26})/ }, { - 'id': 'slack-legacy-token', - 'regex': /(xox[os]-\d+-\d+-\d+-[a-fA-F\d]+)/ + id: 'slack-legacy-token', + regex: /(xox[os]-\d+-\d+-\d+-[a-fA-F\d]+)/ }, { - 'id': 'slack-legacy-workspace-token', - 'regex': /(xox[ar]-(?:\d-)?[0-9a-zA-Z]{8,48})/ + id: 'slack-legacy-workspace-token', + regex: /(xox[ar]-(?:\d-)?[0-9a-zA-Z]{8,48})/ }, { - 'id': 'slack-user-token', - 'regex': /(xox[pe](?:-[0-9]{10,13}){3}-[a-zA-Z0-9-]{28,34})/ + id: 'slack-user-token', + regex: /(xox[pe](?:-[0-9]{10,13}){3}-[a-zA-Z0-9-]{28,34})/ }, { - 'id': 'slack-webhook-url', - 'regex': /(https?:\/\/)?hooks.slack.com\/(services|workflows)\/[A-Za-z0-9+/]{43,46}/ + id: 'slack-webhook-url', + regex: /(https?:\/\/)?hooks.slack.com\/(services|workflows)\/[A-Za-z0-9+/]{43,46}/ }, { - 'id': 'square-access-token', - 'regex': /\b(sq0atp-[0-9a-z\-_]{22})(?:['"\s\x60;]|$)/i + id: 'square-access-token', + regex: /\b(sq0atp-[0-9a-z\-_]{22})(?:['"\s\x60;]|$)/i }, { - 'id': 'square-secret', - 'regex': /\b(sq0csp-[0-9a-z\-_]{43})(?:['"\s\x60;]|$)/i + id: 'square-secret', + regex: /\b(sq0csp-[0-9a-z\-_]{43})(?:['"\s\x60;]|$)/i }, { - 'id': 'stripe-access-token', - 'regex': /(sk|pk)_(test|live)_[0-9a-z]{10,32}/i + id: 'stripe-access-token', + regex: /(sk|pk)_(test|live)_[0-9a-z]{10,32}/i }, { - 'id': 'telegram-bot-api-token', - 'regex': /(?:^|[^0-9])([0-9]{5,16}:A[a-z0-9_-]{34})(?:$|[^a-z0-9_-])/i + id: 'telegram-bot-api-token', + regex: /(?:^|[^0-9])([0-9]{5,16}:A[a-z0-9_-]{34})(?:$|[^a-z0-9_-])/i }, { - 'id': 'twilio-api-key', - 'regex': /SK[0-9a-fA-F]{32}/ + id: 'twilio-api-key', + regex: /SK[0-9a-fA-F]{32}/ }, { - 'id': 'vault-batch-token', - 'regex': /\b(hvb\.[a-z0-9_-]{138,212})(?:['"\s\x60;]|$)/i + id: 'vault-batch-token', + regex: /\b(hvb\.[a-z0-9_-]{138,212})(?:['"\s\x60;]|$)/i }, { - 'id': 'vault-service-token', - 'regex': /\b(hvs\.[a-z0-9_-]{90,100})(?:['"\s\x60;]|$)/i + id: 'vault-service-token', + regex: /\b(hvs\.[a-z0-9_-]{90,100})(?:['"\s\x60;]|$)/i } ] diff --git a/packages/dd-trace/src/appsec/iast/analyzers/hsts-header-missing-analyzer.js b/packages/dd-trace/src/appsec/iast/analyzers/hsts-header-missing-analyzer.js index a5196d3c92f..c5bbd19be99 100644 --- a/packages/dd-trace/src/appsec/iast/analyzers/hsts-header-missing-analyzer.js +++ b/packages/dd-trace/src/appsec/iast/analyzers/hsts-header-missing-analyzer.js @@ -9,6 +9,7 @@ class HstsHeaderMissingAnalyzer extends MissingHeaderAnalyzer { constructor () { super(HSTS_HEADER_MISSING, HSTS_HEADER_NAME) } + _isVulnerableFromRequestAndResponse (req, res) { const headerValues = this._getHeaderValues(res, HSTS_HEADER_NAME) return this._isHttpsProtocol(req) && ( diff --git a/packages/dd-trace/src/appsec/iast/overhead-controller.js b/packages/dd-trace/src/appsec/iast/overhead-controller.js index e7ab0d2f437..42361608a34 100644 --- a/packages/dd-trace/src/appsec/iast/overhead-controller.js +++ b/packages/dd-trace/src/appsec/iast/overhead-controller.js @@ -54,7 +54,8 @@ function _resetGlobalContext () { function acquireRequest (rootSpan) { if (availableRequest > 0 && rootSpan) { const sampling = config && typeof config.requestSampling === 'number' - ? config.requestSampling : 30 + ? config.requestSampling + : 30 if (rootSpan.context().toSpanId().slice(-2) <= sampling) { availableRequest-- return true diff --git a/packages/dd-trace/src/appsec/iast/taint-tracking/index.js b/packages/dd-trace/src/appsec/iast/taint-tracking/index.js index fdb6cc80e15..5c7109c4cda 100644 --- a/packages/dd-trace/src/appsec/iast/taint-tracking/index.js +++ b/packages/dd-trace/src/appsec/iast/taint-tracking/index.js @@ -33,8 +33,8 @@ module.exports = { kafkaContextPlugin.disable() kafkaConsumerPlugin.disable() }, - setMaxTransactions: setMaxTransactions, - createTransaction: createTransaction, - removeTransaction: removeTransaction, + setMaxTransactions, + createTransaction, + removeTransaction, taintTrackingPlugin } diff --git a/packages/dd-trace/src/appsec/iast/taint-tracking/plugin.js b/packages/dd-trace/src/appsec/iast/taint-tracking/plugin.js index 8a498608d4d..f69e18c509f 100644 --- a/packages/dd-trace/src/appsec/iast/taint-tracking/plugin.js +++ b/packages/dd-trace/src/appsec/iast/taint-tracking/plugin.js @@ -30,9 +30,9 @@ class TaintTrackingPlugin extends SourceIastPlugin { { channelName: 'datadog:body-parser:read:finish', tag: HTTP_REQUEST_BODY }, ({ req }) => { const iastContext = getIastContext(storage.getStore()) - if (iastContext && iastContext['body'] !== req.body) { + if (iastContext && iastContext.body !== req.body) { this._taintTrackingHandler(HTTP_REQUEST_BODY, req, 'body', iastContext) - iastContext['body'] = req.body + iastContext.body = req.body } } ) @@ -47,9 +47,9 @@ class TaintTrackingPlugin extends SourceIastPlugin { ({ req }) => { if (req && req.body && typeof req.body === 'object') { const iastContext = getIastContext(storage.getStore()) - if (iastContext && iastContext['body'] !== req.body) { + if (iastContext && iastContext.body !== req.body) { this._taintTrackingHandler(HTTP_REQUEST_BODY, req, 'body', iastContext) - iastContext['body'] = req.body + iastContext.body = req.body } } } diff --git a/packages/dd-trace/src/appsec/iast/taint-tracking/taint-tracking-impl.js b/packages/dd-trace/src/appsec/iast/taint-tracking/taint-tracking-impl.js index bb362b528e0..1d1444abf7b 100644 --- a/packages/dd-trace/src/appsec/iast/taint-tracking/taint-tracking-impl.js +++ b/packages/dd-trace/src/appsec/iast/taint-tracking/taint-tracking-impl.js @@ -107,7 +107,7 @@ function csiMethodsOverrides (getContext) { return TaintedUtils.concat(transactionId, res, op1, op2) } } catch (e) { - iastLog.error(`Error invoking CSI plusOperator`) + iastLog.error('Error invoking CSI plusOperator') .errorAndPublish(e) } return res diff --git a/packages/dd-trace/src/appsec/iast/vulnerabilities-formatter/evidence-redaction/sensitive-analyzers/sql-sensitive-analyzer.js b/packages/dd-trace/src/appsec/iast/vulnerabilities-formatter/evidence-redaction/sensitive-analyzers/sql-sensitive-analyzer.js index 88056f93168..15580b11869 100644 --- a/packages/dd-trace/src/appsec/iast/vulnerabilities-formatter/evidence-redaction/sensitive-analyzers/sql-sensitive-analyzer.js +++ b/packages/dd-trace/src/appsec/iast/vulnerabilities-formatter/evidence-redaction/sensitive-analyzers/sql-sensitive-analyzer.js @@ -68,7 +68,7 @@ module.exports = function extractSensitiveRanges (evidence) { try { let pattern = patterns[evidence.dialect] if (!pattern) { - pattern = patterns['ANSI'] + pattern = patterns.ANSI } pattern.lastIndex = 0 const tokens = [] diff --git a/packages/dd-trace/src/appsec/waf/waf_context_wrapper.js b/packages/dd-trace/src/appsec/waf/waf_context_wrapper.js index de62d74ccfa..7c7f99fba3e 100644 --- a/packages/dd-trace/src/appsec/waf/waf_context_wrapper.js +++ b/packages/dd-trace/src/appsec/waf/waf_context_wrapper.js @@ -39,12 +39,12 @@ class WAFContextWrapper { } if (Object.keys(inputs).length) { - payload['persistent'] = inputs + payload.persistent = inputs payloadHasData = true } if (ephemeral && Object.keys(ephemeral).length) { - payload['ephemeral'] = ephemeral + payload.ephemeral = ephemeral payloadHasData = true } diff --git a/packages/dd-trace/src/ci-visibility/exporters/git/git_metadata.js b/packages/dd-trace/src/ci-visibility/exporters/git/git_metadata.js index a00fedf8dfa..de8ed3bf0bb 100644 --- a/packages/dd-trace/src/ci-visibility/exporters/git/git_metadata.js +++ b/packages/dd-trace/src/ci-visibility/exporters/git/git_metadata.js @@ -1,4 +1,3 @@ - const fs = require('fs') const path = require('path') diff --git a/packages/dd-trace/src/ci-visibility/intelligent-test-runner/get-skippable-suites.js b/packages/dd-trace/src/ci-visibility/intelligent-test-runner/get-skippable-suites.js index 9d410800375..fd9f1662e6a 100644 --- a/packages/dd-trace/src/ci-visibility/intelligent-test-runner/get-skippable-suites.js +++ b/packages/dd-trace/src/ci-visibility/intelligent-test-runner/get-skippable-suites.js @@ -102,7 +102,8 @@ function getSkippableSuites ({ const { meta: { correlation_id: correlationId } } = parsedResponse incrementCountMetric( testLevel === 'test' - ? TELEMETRY_ITR_SKIPPABLE_TESTS_RESPONSE_TESTS : TELEMETRY_ITR_SKIPPABLE_TESTS_RESPONSE_SUITES, + ? TELEMETRY_ITR_SKIPPABLE_TESTS_RESPONSE_TESTS + : TELEMETRY_ITR_SKIPPABLE_TESTS_RESPONSE_SUITES, {}, skippableSuites.length ) diff --git a/packages/dd-trace/src/ci-visibility/test-api-manual/test-api-manual-plugin.js b/packages/dd-trace/src/ci-visibility/test-api-manual/test-api-manual-plugin.js index f6a1612b373..8e0b9351b06 100644 --- a/packages/dd-trace/src/ci-visibility/test-api-manual/test-api-manual-plugin.js +++ b/packages/dd-trace/src/ci-visibility/test-api-manual/test-api-manual-plugin.js @@ -10,6 +10,7 @@ class TestApiManualPlugin extends CiPlugin { static get id () { return 'test-api-manual' } + constructor (...args) { super(...args) this.sourceRoot = process.cwd() diff --git a/packages/dd-trace/src/config.js b/packages/dd-trace/src/config.js index c8aef6e6248..60542c6a7a0 100644 --- a/packages/dd-trace/src/config.js +++ b/packages/dd-trace/src/config.js @@ -23,13 +23,10 @@ const fromEntries = Object.fromEntries || (entries => // eslint-disable-next-line max-len const qsRegex = '(?:p(?:ass)?w(?:or)?d|pass(?:_?phrase)?|secret|(?:api_?|private_?|public_?|access_?|secret_?)key(?:_?id)?|token|consumer_?(?:id|key|secret)|sign(?:ed|ature)?|auth(?:entication|orization)?)(?:(?:\\s|%20)*(?:=|%3D)[^&]+|(?:"|%22)(?:\\s|%20)*(?::|%3A)(?:\\s|%20)*(?:"|%22)(?:%2[^2]|%[^2]|[^"%])+(?:"|%22))|bearer(?:\\s|%20)+[a-z0-9\\._\\-]+|token(?::|%3A)[a-z0-9]{13}|gh[opsu]_[0-9a-zA-Z]{36}|ey[I-L](?:[\\w=-]|%3D)+\\.ey[I-L](?:[\\w=-]|%3D)+(?:\\.(?:[\\w.+\\/=-]|%3D|%2F|%2B)+)?|[\\-]{5}BEGIN(?:[a-z\\s]|%20)+PRIVATE(?:\\s|%20)KEY[\\-]{5}[^\\-]+[\\-]{5}END(?:[a-z\\s]|%20)+PRIVATE(?:\\s|%20)KEY|ssh-rsa(?:\\s|%20)*(?:[a-z0-9\\/\\.+]|%2F|%5C|%2B){100,}' -const defaultWafObfuscatorKeyRegex = `(?i)(?:p(?:ass)?w(?:or)?d|pass(?:_?phrase)?|secret|(?:api_?|private_?\ -|public_?)key)|token|consumer_?(?:id|key|secret)|sign(?:ed|ature)|bearer|authorization` -const defaultWafObfuscatorValueRegex = -`(?i)(?:p(?:ass)?w(?:or)?d|pass(?:_?phrase)?|secret|(?:api_?|private_?|public_?|access_?|secret_?)key(?:_?id)?|to\ -ken|consumer_?(?:id|key|secret)|sign(?:ed|ature)?|auth(?:entication|orization)?)(?:\\s*=[^;]|"\\s*:\\s*"[^"]+")|bearer\ -\\s+[a-z0-9\\._\\-]+|token:[a-z0-9]{13}|gh[opsu]_[0-9a-zA-Z]{36}|ey[I-L][\\w=-]+\\.ey[I-L][\\w=-]+(?:\\.[\\w.+\\/=-]+)?\ -|[\\-]{5}BEGIN[a-z\\s]+PRIVATE\\sKEY[\\-]{5}[^\\-]+[\\-]{5}END[a-z\\s]+PRIVATE\\sKEY|ssh-rsa\\s*[a-z0-9\\/\\.+]{100,}` +// eslint-disable-next-line max-len +const defaultWafObfuscatorKeyRegex = '(?i)(?:p(?:ass)?w(?:or)?d|pass(?:_?phrase)?|secret|(?:api_?|private_?|public_?)key)|token|consumer_?(?:id|key|secret)|sign(?:ed|ature)|bearer|authorization' +// eslint-disable-next-line max-len +const defaultWafObfuscatorValueRegex = '(?i)(?:p(?:ass)?w(?:or)?d|pass(?:_?phrase)?|secret|(?:api_?|private_?|public_?|access_?|secret_?)key(?:_?id)?|token|consumer_?(?:id|key|secret)|sign(?:ed|ature)?|auth(?:entication|orization)?)(?:\\s*=[^;]|"\\s*:\\s*"[^"]+")|bearer\\s+[a-z0-9\\._\\-]+|token:[a-z0-9]{13}|gh[opsu]_[0-9a-zA-Z]{36}|ey[I-L][\\w=-]+\\.ey[I-L][\\w=-]+(?:\\.[\\w.+\\/=-]+)?|[\\-]{5}BEGIN[a-z\\s]+PRIVATE\\sKEY[\\-]{5}[^\\-]+[\\-]{5}END[a-z\\s]+PRIVATE\\sKEY|ssh-rsa\\s*[a-z0-9\\/\\.+]{100,}' function maybeFile (filepath) { if (!filepath) return @@ -132,9 +129,11 @@ class Config { const DD_SERVICE_MAPPING = coalesce( options.serviceMapping, - process.env.DD_SERVICE_MAPPING ? fromEntries( - process.env.DD_SERVICE_MAPPING.split(',').map(x => x.trim().split(':')) - ) : {} + process.env.DD_SERVICE_MAPPING + ? fromEntries( + process.env.DD_SERVICE_MAPPING.split(',').map(x => x.trim().split(':')) + ) + : {} ) const DD_API_KEY = coalesce( @@ -704,7 +703,7 @@ class Config { _isCiVisibility () { return coalesce( this.options.isCiVisibility, - this._defaults['isCiVisibility'] + this._defaults.isCiVisibility ) } @@ -717,7 +716,8 @@ class Config { _getHostname () { const DD_CIVISIBILITY_AGENTLESS_URL = process.env.DD_CIVISIBILITY_AGENTLESS_URL - const url = DD_CIVISIBILITY_AGENTLESS_URL ? new URL(DD_CIVISIBILITY_AGENTLESS_URL) + const url = DD_CIVISIBILITY_AGENTLESS_URL + ? new URL(DD_CIVISIBILITY_AGENTLESS_URL) : getAgentUrl(this._getTraceAgentUrl(), this.options) const DD_AGENT_HOST = coalesce( this.options.hostname, @@ -808,7 +808,7 @@ class Config { } this._setString(calc, 'dogstatsd.hostname', this._getHostname()) this._setBoolean(calc, 'isGitUploadEnabled', - calc['isIntelligentTestRunnerEnabled'] && !isFalse(this._isCiVisibilityGitUploadEnabled())) + calc.isIntelligentTestRunnerEnabled && !isFalse(this._isCiVisibilityGitUploadEnabled())) this._setBoolean(calc, 'spanComputePeerService', this._getSpanComputePeerService()) this._setBoolean(calc, 'stats.enabled', this._isTraceStatsComputationEnabled()) } diff --git a/packages/dd-trace/src/datastreams/pathway.js b/packages/dd-trace/src/datastreams/pathway.js index 52253f09ed7..b813b622ca6 100644 --- a/packages/dd-trace/src/datastreams/pathway.js +++ b/packages/dd-trace/src/datastreams/pathway.js @@ -22,7 +22,7 @@ function computeHash (service, env, edgeTags, parentHash) { return cache.get(key) } const currentHash = shaHash(`${service}${env}` + edgeTags.join('')) - const buf = Buffer.concat([ currentHash, parentHash ], 16) + const buf = Buffer.concat([currentHash, parentHash], 16) const val = shaHash(buf.toString()) cache.set(key, val) return val diff --git a/packages/dd-trace/src/datastreams/processor.js b/packages/dd-trace/src/datastreams/processor.js index ca033bccc01..9aaaafa9de2 100644 --- a/packages/dd-trace/src/datastreams/processor.js +++ b/packages/dd-trace/src/datastreams/processor.js @@ -273,12 +273,12 @@ class DataStreamsProcessor { const edgeLatencyNs = nowNs - edgeStartNs const pathwayLatencyNs = nowNs - pathwayStartNs const dataStreamsContext = { - hash: hash, - edgeStartNs: edgeStartNs, - pathwayStartNs: pathwayStartNs, + hash, + edgeStartNs, + pathwayStartNs, previousDirection: direction, - closestOppositeDirectionHash: closestOppositeDirectionHash, - closestOppositeDirectionEdgeStart: closestOppositeDirectionEdgeStart + closestOppositeDirectionHash, + closestOppositeDirectionEdgeStart } if (direction === 'direction:out') { // Add the header for this now, as the callee doesn't have access to context when producing @@ -289,12 +289,12 @@ class DataStreamsProcessor { } const checkpoint = { currentTimestamp: nowNs, - parentHash: parentHash, - hash: hash, - edgeTags: edgeTags, - edgeLatencyNs: edgeLatencyNs, - pathwayLatencyNs: pathwayLatencyNs, - payloadSize: payloadSize + parentHash, + hash, + edgeTags, + edgeLatencyNs, + pathwayLatencyNs, + payloadSize } this.recordCheckpoint(checkpoint, span) return dataStreamsContext @@ -320,7 +320,7 @@ class DataStreamsProcessor { // TimeBuckets const serializedBuckets = [] - for (const [ timeNs, bucket ] of this.buckets.entries()) { + for (const [timeNs, bucket] of this.buckets.entries()) { const points = [] // bucket: StatsBucket @@ -354,9 +354,9 @@ class DataStreamsProcessor { } module.exports = { - DataStreamsProcessor: DataStreamsProcessor, - StatsPoint: StatsPoint, - StatsBucket: StatsBucket, + DataStreamsProcessor, + StatsPoint, + StatsBucket, Backlog, TimeBuckets, getMessageSize, diff --git a/packages/dd-trace/src/encode/agentless-ci-visibility.js b/packages/dd-trace/src/encode/agentless-ci-visibility.js index 5b7d3b54c75..7b78c0ea3ce 100644 --- a/packages/dd-trace/src/encode/agentless-ci-visibility.js +++ b/packages/dd-trace/src/encode/agentless-ci-visibility.js @@ -328,8 +328,8 @@ class AgentlessCiVisibilityEncoder extends AgentEncoder { version: ENCODING_VERSION, metadata: { '*': { - 'language': 'javascript', - 'library_version': ddTraceVersion + language: 'javascript', + library_version: ddTraceVersion } }, events: [] diff --git a/packages/dd-trace/src/encode/coverage-ci-visibility.js b/packages/dd-trace/src/encode/coverage-ci-visibility.js index 75da679340c..bdf4b17a3cc 100644 --- a/packages/dd-trace/src/encode/coverage-ci-visibility.js +++ b/packages/dd-trace/src/encode/coverage-ci-visibility.js @@ -108,7 +108,7 @@ class CoverageCIVisibilityEncoder extends AgentEncoder { 'coverage1', buffer, { - filename: `coverage1.msgpack`, + filename: 'coverage1.msgpack', contentType: 'application/msgpack' } ) diff --git a/packages/dd-trace/src/exporters/common/request.js b/packages/dd-trace/src/exporters/common/request.js index 41a211c79ea..62f3bafb03e 100644 --- a/packages/dd-trace/src/exporters/common/request.js +++ b/packages/dd-trace/src/exporters/common/request.js @@ -6,6 +6,7 @@ const { Readable } = require('stream') const http = require('http') const https = require('https') +// eslint-disable-next-line n/no-deprecated-api const { parse: urlParse } = require('url') const zlib = require('zlib') diff --git a/packages/dd-trace/src/exporters/span-stats/writer.js b/packages/dd-trace/src/exporters/span-stats/writer.js index 11cc09128c4..3ece6d221b4 100644 --- a/packages/dd-trace/src/exporters/span-stats/writer.js +++ b/packages/dd-trace/src/exporters/span-stats/writer.js @@ -1,4 +1,3 @@ - const { SpanStatsEncoder } = require('../../encode/span-stats') const pkg = require('../../../../../package.json') diff --git a/packages/dd-trace/src/external-logger/src/index.js b/packages/dd-trace/src/external-logger/src/index.js index 20a6466874d..aa21b20b6e7 100644 --- a/packages/dd-trace/src/external-logger/src/index.js +++ b/packages/dd-trace/src/external-logger/src/index.js @@ -51,11 +51,11 @@ class ExternalLogger { const payload = { ...log, - 'timestamp': Date.now(), - 'hostname': log.hostname || this.hostname, - 'ddsource': log.ddsource || this.ddsource, - 'service': log.service || this.service, - 'ddtags': logTags || undefined + timestamp: Date.now(), + hostname: log.hostname || this.hostname, + ddsource: log.ddsource || this.ddsource, + service: log.service || this.service, + ddtags: logTags || undefined } this.enqueue(payload) diff --git a/packages/dd-trace/src/opentelemetry/span.js b/packages/dd-trace/src/opentelemetry/span.js index 1bd20ca18e6..6e7bd84ae85 100644 --- a/packages/dd-trace/src/opentelemetry/span.js +++ b/packages/dd-trace/src/opentelemetry/span.js @@ -161,9 +161,11 @@ class Span { get resource () { return this._parentTracer.resource } + get instrumentationLibrary () { return this._parentTracer.instrumentationLibrary } + get _spanProcessor () { return this._parentTracer.getActiveSpanProcessor() } diff --git a/packages/dd-trace/src/opentracing/propagation/text_map.js b/packages/dd-trace/src/opentracing/propagation/text_map.js index d09d86154fd..101a8bf41bc 100644 --- a/packages/dd-trace/src/opentracing/propagation/text_map.js +++ b/packages/dd-trace/src/opentracing/propagation/text_map.js @@ -321,7 +321,7 @@ class TextMapPropagator { } const matches = headerValue.trim().match(traceparentExpr) if (matches.length) { - const [ version, traceId, spanId, flags, tail ] = matches.slice(1) + const [version, traceId, spanId, flags, tail] = matches.slice(1) const traceparent = { version } const tracestate = TraceState.fromString(carrier.tracestate) if (invalidSegment.test(traceId)) return null diff --git a/packages/dd-trace/src/opentracing/span.js b/packages/dd-trace/src/opentracing/span.js index fb1b8c53c74..c90ea04f7bb 100644 --- a/packages/dd-trace/src/opentracing/span.js +++ b/packages/dd-trace/src/opentracing/span.js @@ -210,7 +210,7 @@ class DatadogSpan { // Wrap the value as a string if it's not already a string sanitizedAttributes[key] = typeof maybeScalar === 'string' ? maybeScalar : String(maybeScalar) } else { - log.warn(`Dropping span link attribute. It is not of an allowed type`) + log.warn('Dropping span link attribute. It is not of an allowed type') } } } diff --git a/packages/dd-trace/src/plugins/composite.js b/packages/dd-trace/src/plugins/composite.js index 0cf548f1b5d..a3b422a9f1d 100644 --- a/packages/dd-trace/src/plugins/composite.js +++ b/packages/dd-trace/src/plugins/composite.js @@ -14,10 +14,9 @@ class CompositePlugin extends Plugin { configure (config) { super.configure(config) for (const name in this.constructor.plugins) { - const pluginConfig = config[name] === false ? false : { - ...config, - ...config[name] - } + const pluginConfig = config[name] === false + ? false + : { ...config, ...config[name] } this[name].configure(pluginConfig) } diff --git a/packages/dd-trace/src/plugins/database.js b/packages/dd-trace/src/plugins/database.js index a868c594db7..172c0190b3d 100644 --- a/packages/dd-trace/src/plugins/database.js +++ b/packages/dd-trace/src/plugins/database.js @@ -20,6 +20,7 @@ class DatabasePlugin extends StoragePlugin { encodedDdpv: '' } } + encodingServiceTags (serviceTag, encodeATag, spanConfig) { if (serviceTag !== spanConfig) { this.serviceTags[serviceTag] = spanConfig diff --git a/packages/dd-trace/src/plugins/index.js b/packages/dd-trace/src/plugins/index.js index 2fa4e406363..11172ddac92 100644 --- a/packages/dd-trace/src/plugins/index.js +++ b/packages/dd-trace/src/plugins/index.js @@ -18,66 +18,66 @@ module.exports = { get '@opensearch-project/opensearch' () { return require('../../../datadog-plugin-opensearch/src') }, get '@redis/client' () { return require('../../../datadog-plugin-redis/src') }, get '@smithy/smithy-client' () { return require('../../../datadog-plugin-aws-sdk/src') }, - get 'aerospike' () { return require('../../../datadog-plugin-aerospike/src') }, - get 'amqp10' () { return require('../../../datadog-plugin-amqp10/src') }, - get 'amqplib' () { return require('../../../datadog-plugin-amqplib/src') }, + get aerospike () { return require('../../../datadog-plugin-aerospike/src') }, + get amqp10 () { return require('../../../datadog-plugin-amqp10/src') }, + get amqplib () { return require('../../../datadog-plugin-amqplib/src') }, get 'aws-sdk' () { return require('../../../datadog-plugin-aws-sdk/src') }, - get 'bunyan' () { return require('../../../datadog-plugin-bunyan/src') }, + get bunyan () { return require('../../../datadog-plugin-bunyan/src') }, get 'cassandra-driver' () { return require('../../../datadog-plugin-cassandra-driver/src') }, - get 'child_process' () { return require('../../../datadog-plugin-child_process/src') }, - get 'connect' () { return require('../../../datadog-plugin-connect/src') }, - get 'couchbase' () { return require('../../../datadog-plugin-couchbase/src') }, - get 'cypress' () { return require('../../../datadog-plugin-cypress/src') }, - get 'dns' () { return require('../../../datadog-plugin-dns/src') }, - get 'elasticsearch' () { return require('../../../datadog-plugin-elasticsearch/src') }, - get 'express' () { return require('../../../datadog-plugin-express/src') }, - get 'fastify' () { return require('../../../datadog-plugin-fastify/src') }, + get child_process () { return require('../../../datadog-plugin-child_process/src') }, + get connect () { return require('../../../datadog-plugin-connect/src') }, + get couchbase () { return require('../../../datadog-plugin-couchbase/src') }, + get cypress () { return require('../../../datadog-plugin-cypress/src') }, + get dns () { return require('../../../datadog-plugin-dns/src') }, + get elasticsearch () { return require('../../../datadog-plugin-elasticsearch/src') }, + get express () { return require('../../../datadog-plugin-express/src') }, + get fastify () { return require('../../../datadog-plugin-fastify/src') }, get 'find-my-way' () { return require('../../../datadog-plugin-find-my-way/src') }, - get 'graphql' () { return require('../../../datadog-plugin-graphql/src') }, - get 'grpc' () { return require('../../../datadog-plugin-grpc/src') }, - get 'hapi' () { return require('../../../datadog-plugin-hapi/src') }, - get 'http' () { return require('../../../datadog-plugin-http/src') }, - get 'http2' () { return require('../../../datadog-plugin-http2/src') }, - get 'https' () { return require('../../../datadog-plugin-http/src') }, - get 'ioredis' () { return require('../../../datadog-plugin-ioredis/src') }, + get graphql () { return require('../../../datadog-plugin-graphql/src') }, + get grpc () { return require('../../../datadog-plugin-grpc/src') }, + get hapi () { return require('../../../datadog-plugin-hapi/src') }, + get http () { return require('../../../datadog-plugin-http/src') }, + get http2 () { return require('../../../datadog-plugin-http2/src') }, + get https () { return require('../../../datadog-plugin-http/src') }, + get ioredis () { return require('../../../datadog-plugin-ioredis/src') }, get 'jest-circus' () { return require('../../../datadog-plugin-jest/src') }, get 'jest-config' () { return require('../../../datadog-plugin-jest/src') }, get 'jest-environment-node' () { return require('../../../datadog-plugin-jest/src') }, get 'jest-environment-jsdom' () { return require('../../../datadog-plugin-jest/src') }, get 'jest-jasmine2' () { return require('../../../datadog-plugin-jest/src') }, get 'jest-worker' () { return require('../../../datadog-plugin-jest/src') }, - get 'koa' () { return require('../../../datadog-plugin-koa/src') }, + get koa () { return require('../../../datadog-plugin-koa/src') }, get 'koa-router' () { return require('../../../datadog-plugin-koa/src') }, - get 'kafkajs' () { return require('../../../datadog-plugin-kafkajs/src') }, - get 'mariadb' () { return require('../../../datadog-plugin-mariadb/src') }, - get 'memcached' () { return require('../../../datadog-plugin-memcached/src') }, + get kafkajs () { return require('../../../datadog-plugin-kafkajs/src') }, + get mariadb () { return require('../../../datadog-plugin-mariadb/src') }, + get memcached () { return require('../../../datadog-plugin-memcached/src') }, get 'microgateway-core' () { return require('../../../datadog-plugin-microgateway-core/src') }, - get 'mocha' () { return require('../../../datadog-plugin-mocha/src') }, + get mocha () { return require('../../../datadog-plugin-mocha/src') }, get 'mocha-each' () { return require('../../../datadog-plugin-mocha/src') }, - get 'moleculer' () { return require('../../../datadog-plugin-moleculer/src') }, - get 'mongodb' () { return require('../../../datadog-plugin-mongodb-core/src') }, + get moleculer () { return require('../../../datadog-plugin-moleculer/src') }, + get mongodb () { return require('../../../datadog-plugin-mongodb-core/src') }, get 'mongodb-core' () { return require('../../../datadog-plugin-mongodb-core/src') }, - get 'mysql' () { return require('../../../datadog-plugin-mysql/src') }, - get 'mysql2' () { return require('../../../datadog-plugin-mysql2/src') }, - get 'net' () { return require('../../../datadog-plugin-net/src') }, - get 'next' () { return require('../../../datadog-plugin-next/src') }, + get mysql () { return require('../../../datadog-plugin-mysql/src') }, + get mysql2 () { return require('../../../datadog-plugin-mysql2/src') }, + get net () { return require('../../../datadog-plugin-net/src') }, + get next () { return require('../../../datadog-plugin-next/src') }, get 'node:dns' () { return require('../../../datadog-plugin-dns/src') }, get 'node:http' () { return require('../../../datadog-plugin-http/src') }, get 'node:http2' () { return require('../../../datadog-plugin-http2/src') }, get 'node:https' () { return require('../../../datadog-plugin-http/src') }, get 'node:net' () { return require('../../../datadog-plugin-net/src') }, - get 'oracledb' () { return require('../../../datadog-plugin-oracledb/src') }, - get 'openai' () { return require('../../../datadog-plugin-openai/src') }, - get 'paperplane' () { return require('../../../datadog-plugin-paperplane/src') }, - get 'pg' () { return require('../../../datadog-plugin-pg/src') }, - get 'pino' () { return require('../../../datadog-plugin-pino/src') }, + get oracledb () { return require('../../../datadog-plugin-oracledb/src') }, + get openai () { return require('../../../datadog-plugin-openai/src') }, + get paperplane () { return require('../../../datadog-plugin-paperplane/src') }, + get pg () { return require('../../../datadog-plugin-pg/src') }, + get pino () { return require('../../../datadog-plugin-pino/src') }, get 'pino-pretty' () { return require('../../../datadog-plugin-pino/src') }, - get 'playwright' () { return require('../../../datadog-plugin-playwright/src') }, - get 'redis' () { return require('../../../datadog-plugin-redis/src') }, - get 'restify' () { return require('../../../datadog-plugin-restify/src') }, - get 'rhea' () { return require('../../../datadog-plugin-rhea/src') }, - get 'router' () { return require('../../../datadog-plugin-router/src') }, - get 'sharedb' () { return require('../../../datadog-plugin-sharedb/src') }, - get 'tedious' () { return require('../../../datadog-plugin-tedious/src') }, - get 'winston' () { return require('../../../datadog-plugin-winston/src') } + get playwright () { return require('../../../datadog-plugin-playwright/src') }, + get redis () { return require('../../../datadog-plugin-redis/src') }, + get restify () { return require('../../../datadog-plugin-restify/src') }, + get rhea () { return require('../../../datadog-plugin-rhea/src') }, + get router () { return require('../../../datadog-plugin-router/src') }, + get sharedb () { return require('../../../datadog-plugin-sharedb/src') }, + get tedious () { return require('../../../datadog-plugin-tedious/src') }, + get winston () { return require('../../../datadog-plugin-winston/src') } } diff --git a/packages/dd-trace/src/plugins/plugin.js b/packages/dd-trace/src/plugins/plugin.js index 7bc5562bbcc..955819094d4 100644 --- a/packages/dd-trace/src/plugins/plugin.js +++ b/packages/dd-trace/src/plugins/plugin.js @@ -84,7 +84,7 @@ module.exports = class Plugin { if (!store || !store.span) return - if (!store.span._spanContext._tags['error']) { + if (!store.span._spanContext._tags.error) { store.span.setTag('error', error || 1) } } diff --git a/packages/dd-trace/src/plugins/tracing.js b/packages/dd-trace/src/plugins/tracing.js index 150823ecfd4..d2d487a4a6f 100644 --- a/packages/dd-trace/src/plugins/tracing.js +++ b/packages/dd-trace/src/plugins/tracing.js @@ -94,7 +94,7 @@ class TracingPlugin extends Plugin { } addError (error, span = this.activeSpan) { - if (!span._spanContext._tags['error']) { + if (!span._spanContext._tags.error) { // Errors may be wrapped in a context. error = (error && error.error) || error span.setTag('error', error || 1) diff --git a/packages/dd-trace/src/plugins/util/test.js b/packages/dd-trace/src/plugins/util/test.js index 7f74e6444b7..76671e4d1a9 100644 --- a/packages/dd-trace/src/plugins/util/test.js +++ b/packages/dd-trace/src/plugins/util/test.js @@ -288,7 +288,8 @@ function getTestSuitePath (testSuiteAbsolutePath, sourceRoot) { return sourceRoot } const testSuitePath = testSuiteAbsolutePath === sourceRoot - ? testSuiteAbsolutePath : path.relative(sourceRoot, testSuiteAbsolutePath) + ? testSuiteAbsolutePath + : path.relative(sourceRoot, testSuiteAbsolutePath) return testSuitePath.replace(path.sep, '/') } diff --git a/packages/dd-trace/src/plugins/util/web.js b/packages/dd-trace/src/plugins/util/web.js index 3e8bc787c72..c9cdf1990aa 100644 --- a/packages/dd-trace/src/plugins/util/web.js +++ b/packages/dd-trace/src/plugins/util/web.js @@ -63,7 +63,7 @@ const web = { if (!span) return span.context()._name = `${name}.request` - span.context()._tags['component'] = name + span.context()._tags.component = name web.setConfig(req, config) }, @@ -263,7 +263,7 @@ const web = { const context = contexts.get(req) const span = context.span const error = context.error - const hasExistingError = span.context()._tags['error'] || span.context()._tags[ERROR_MESSAGE] + const hasExistingError = span.context()._tags.error || span.context()._tags[ERROR_MESSAGE] if (!hasExistingError && !context.config.validateStatus(statusCode)) { span.setTag(ERROR, error || true) @@ -405,7 +405,7 @@ function addAllowHeaders (req, res, headers) { } function isOriginAllowed (req, headers) { - const origin = req.headers['origin'] + const origin = req.headers.origin const allowOrigin = headers['access-control-allow-origin'] return origin && (allowOrigin === '*' || allowOrigin === origin) @@ -498,7 +498,7 @@ function extractURL (req) { return `${headers[HTTP2_HEADER_SCHEME]}://${headers[HTTP2_HEADER_AUTHORITY]}${headers[HTTP2_HEADER_PATH]}` } else { const protocol = getProtocol(req) - return `${protocol}://${req.headers['host']}${req.originalUrl || req.url}` + return `${protocol}://${req.headers.host}${req.originalUrl || req.url}` } } diff --git a/packages/dd-trace/src/profiling/config.js b/packages/dd-trace/src/profiling/config.js index dad463d1ea9..de79485092a 100644 --- a/packages/dd-trace/src/profiling/config.js +++ b/packages/dd-trace/src/profiling/config.js @@ -237,7 +237,7 @@ function ensureOOMExportStrategies (strategies, options) { } } - return [ ...new Set(strategies) ] + return [...new Set(strategies)] } function getExporter (name, options) { diff --git a/packages/dd-trace/src/profiling/loggers/console.js b/packages/dd-trace/src/profiling/loggers/console.js index ddc7f8fb6f2..263f79bd43e 100644 --- a/packages/dd-trace/src/profiling/loggers/console.js +++ b/packages/dd-trace/src/profiling/loggers/console.js @@ -12,7 +12,7 @@ const mapping = { class ConsoleLogger { constructor (options = {}) { - this._level = mapping[options.level] || mapping['error'] + this._level = mapping[options.level] || mapping.error } debug (message) { diff --git a/packages/dd-trace/src/profiling/profilers/events.js b/packages/dd-trace/src/profiling/profilers/events.js index 32f523640fa..cfe55e2bb10 100644 --- a/packages/dd-trace/src/profiling/profilers/events.js +++ b/packages/dd-trace/src/profiling/profilers/events.js @@ -258,7 +258,7 @@ class EventsProfiler { sample: samples, location: locations, function: functions, - stringTable: stringTable + stringTable }) } diff --git a/packages/dd-trace/src/runtime_metrics.js b/packages/dd-trace/src/runtime_metrics.js index 37d075c2b25..b2711879a05 100644 --- a/packages/dd-trace/src/runtime_metrics.js +++ b/packages/dd-trace/src/runtime_metrics.js @@ -238,12 +238,15 @@ function captureHistograms () { * * performance.eventLoopUtilization available in Node.js >= v14.10, >= v12.19, >= v16 */ -const captureELU = ('eventLoopUtilization' in performance) ? () => { - // if elu is undefined (first run) the measurement is from start of process - elu = performance.eventLoopUtilization(elu) +let captureELU = () => {} +if ('eventLoopUtilization' in performance) { + captureELU = () => { + // if elu is undefined (first run) the measurement is from start of process + elu = performance.eventLoopUtilization(elu) - client.gauge('runtime.node.event_loop.utilization', elu.utilization) -} : () => {} + client.gauge('runtime.node.event_loop.utilization', elu.utilization) + } +} function captureCommonMetrics () { captureMemoryUsage() diff --git a/packages/dd-trace/src/serverless.js b/packages/dd-trace/src/serverless.js index 1180f0d1060..b863a56afed 100644 --- a/packages/dd-trace/src/serverless.js +++ b/packages/dd-trace/src/serverless.js @@ -4,7 +4,7 @@ const log = require('./log') function maybeStartServerlessMiniAgent (config) { if (process.platform !== 'win32' && process.platform !== 'linux') { - log.error(`Serverless Mini Agent is only supported on Windows and Linux.`) + log.error('Serverless Mini Agent is only supported on Windows and Linux.') return } @@ -34,7 +34,8 @@ function getRustBinaryPath (config) { const rustBinaryPathRoot = config.isGCPFunction ? '/workspace' : '/home/site/wwwroot' const rustBinaryPathOsFolder = process.platform === 'win32' - ? 'datadog-serverless-agent-windows-amd64' : 'datadog-serverless-agent-linux-amd64' + ? 'datadog-serverless-agent-windows-amd64' + : 'datadog-serverless-agent-linux-amd64' const rustBinaryExtension = process.platform === 'win32' ? '.exe' : '' diff --git a/packages/dd-trace/src/service-naming/schemas/v1/storage.js b/packages/dd-trace/src/service-naming/schemas/v1/storage.js index 3b1de3c63a0..96389e63652 100644 --- a/packages/dd-trace/src/service-naming/schemas/v1/storage.js +++ b/packages/dd-trace/src/service-naming/schemas/v1/storage.js @@ -1,4 +1,3 @@ - function configWithFallback ({ tracerService, pluginConfig }) { return pluginConfig.service || tracerService } diff --git a/packages/dd-trace/src/span_processor.js b/packages/dd-trace/src/span_processor.js index f8feec0886b..6dc19407d56 100644 --- a/packages/dd-trace/src/span_processor.js +++ b/packages/dd-trace/src/span_processor.js @@ -58,11 +58,11 @@ class SpanProcessor { } if (this._killAll) { - started.map(startedSpan => { + for (const startedSpan of started) { if (!startedSpan._finished) { startedSpan.finish() } - }) + } } } diff --git a/packages/dd-trace/src/span_stats.js b/packages/dd-trace/src/span_stats.js index 9dd0139e34a..67b8089ec16 100644 --- a/packages/dd-trace/src/span_stats.js +++ b/packages/dd-trace/src/span_stats.js @@ -181,7 +181,7 @@ class SpanStatsProcessor { const { bucketSizeNs } = this const serializedBuckets = [] - for (const [ timeNs, bucket ] of this.buckets.entries()) { + for (const [timeNs, bucket] of this.buckets.entries()) { const bucketAggStats = [] for (const stats of bucket.values()) { diff --git a/packages/dd-trace/src/telemetry/dependencies.js b/packages/dd-trace/src/telemetry/dependencies.js index 5ec0a435b71..992dde7d2ec 100644 --- a/packages/dd-trace/src/telemetry/dependencies.js +++ b/packages/dd-trace/src/telemetry/dependencies.js @@ -12,7 +12,7 @@ const savedDependenciesToSend = new Set() const detectedDependencyKeys = new Set() const detectedDependencyVersions = new Set() -const FILE_URI_START = `file://` +const FILE_URI_START = 'file://' const moduleLoadStartChannel = dc.channel('dd-trace:moduleLoadStart') let immediate, config, application, host, initialLoad @@ -21,12 +21,11 @@ let getRetryData let updateRetryData function createBatchPayload (payload) { - const batchPayload = [] - payload.map(item => { - batchPayload.push({ + const batchPayload = payload.map(item => { + return { request_type: item.reqType, payload: item.payload - }) + } }) return batchPayload diff --git a/packages/dd-trace/src/telemetry/index.js b/packages/dd-trace/src/telemetry/index.js index 6dd872dd217..0921851a65e 100644 --- a/packages/dd-trace/src/telemetry/index.js +++ b/packages/dd-trace/src/telemetry/index.js @@ -35,7 +35,7 @@ function updateRetryData (error, retryObj) { if (retryObj.reqType === 'message-batch') { const payload = retryObj.payload[0].payload const reqType = retryObj.payload[0].request_type - retryData = { payload: payload, reqType: reqType } + retryData = { payload, reqType } // Since this payload failed twice it now gets save in to the extended heartbeat const failedPayload = retryObj.payload[1].payload @@ -43,17 +43,17 @@ function updateRetryData (error, retryObj) { // save away the dependencies and integration request for extended heartbeat. if (failedReqType === 'app-integrations-change') { - if (extendedHeartbeatPayload['integrations']) { - extendedHeartbeatPayload['integrations'].push(failedPayload) + if (extendedHeartbeatPayload.integrations) { + extendedHeartbeatPayload.integrations.push(failedPayload) } else { - extendedHeartbeatPayload['integrations'] = [failedPayload] + extendedHeartbeatPayload.integrations = [failedPayload] } } if (failedReqType === 'app-dependencies-loaded') { - if (extendedHeartbeatPayload['dependencies']) { - extendedHeartbeatPayload['dependencies'].push(failedPayload) + if (extendedHeartbeatPayload.dependencies) { + extendedHeartbeatPayload.dependencies.push(failedPayload) } else { - extendedHeartbeatPayload['dependencies'] = [failedPayload] + extendedHeartbeatPayload.dependencies = [failedPayload] } } } else { @@ -187,12 +187,11 @@ function getTelemetryData () { } function createBatchPayload (payload) { - const batchPayload = [] - payload.map(item => { - batchPayload.push({ + const batchPayload = payload.map(item => { + return { request_type: item.reqType, payload: item.payload - }) + } }) return batchPayload @@ -202,10 +201,10 @@ function createPayload (currReqType, currPayload = {}) { if (getRetryData()) { const payload = { reqType: currReqType, payload: currPayload } const batchPayload = createBatchPayload([payload, retryData]) - return { 'reqType': 'message-batch', 'payload': batchPayload } + return { reqType: 'message-batch', payload: batchPayload } } - return { 'reqType': currReqType, 'payload': currPayload } + return { reqType: currReqType, payload: currPayload } } function heartbeat (config, application, host) { diff --git a/packages/dd-trace/src/telemetry/send-data.js b/packages/dd-trace/src/telemetry/send-data.js index 5f03e89a7cc..813fa427812 100644 --- a/packages/dd-trace/src/telemetry/send-data.js +++ b/packages/dd-trace/src/telemetry/send-data.js @@ -1,4 +1,3 @@ - const request = require('../exporters/common/request') const log = require('../log') const { isTrue } = require('../util') diff --git a/packages/dd-trace/src/util.js b/packages/dd-trace/src/util.js index 04634b62359..77ab79aa537 100644 --- a/packages/dd-trace/src/util.js +++ b/packages/dd-trace/src/util.js @@ -32,13 +32,6 @@ function globMatch (pattern, subject) { if (px < pattern.length) { const c = pattern[px] switch (c) { - default: // ordinary character - if (sx < subject.length && subject[sx] === c) { - px++ - sx++ - continue - } - break case '?': if (sx < subject.length) { px++ @@ -51,6 +44,13 @@ function globMatch (pattern, subject) { nextSx = sx + 1 px++ continue + default: // ordinary character + if (sx < subject.length && subject[sx] === c) { + px++ + sx++ + continue + } + break } } if (nextSx > 0 && nextSx <= subject.length) { diff --git a/packages/dd-trace/test/appsec/blocking.spec.js b/packages/dd-trace/test/appsec/blocking.spec.js index 0096a1938d4..600ce92772c 100644 --- a/packages/dd-trace/test/appsec/blocking.spec.js +++ b/packages/dd-trace/test/appsec/blocking.spec.js @@ -271,7 +271,7 @@ describe('blocking', () => { block(req, res, rootSpan) expect(res.writeHead).to.have.been.calledOnceWithExactly(301, { - 'Location': '/you-have-been-blocked' + Location: '/you-have-been-blocked' }) expect(res.end).to.have.been.calledOnce }) diff --git a/packages/dd-trace/test/appsec/graphql.spec.js b/packages/dd-trace/test/appsec/graphql.spec.js index e34e8541780..827c7915d06 100644 --- a/packages/dd-trace/test/appsec/graphql.spec.js +++ b/packages/dd-trace/test/appsec/graphql.spec.js @@ -128,7 +128,7 @@ describe('GraphQL', () => { it('Should not call waf if req is unavailable', () => { const context = {} const resolverInfo = { - user: [ { id: '1234' } ] + user: [{ id: '1234' }] } storage.getStore().req = undefined @@ -142,7 +142,7 @@ describe('GraphQL', () => { const context = {} const resolverInfo = { - user: [ { id: '1234' } ] + user: [{ id: '1234' }] } startGraphqlResolve.publish({ context, resolverInfo }) @@ -180,7 +180,7 @@ describe('GraphQL', () => { } const resolverInfo = { - user: [ { id: '1234' } ] + user: [{ id: '1234' }] } const abortController = {} @@ -210,7 +210,7 @@ describe('GraphQL', () => { } const resolverInfo = { - user: [ { id: '1234' } ] + user: [{ id: '1234' }] } const abortController = context.abortController diff --git a/packages/dd-trace/test/appsec/iast/analyzers/header-injection.express.plugin.spec.js b/packages/dd-trace/test/appsec/iast/analyzers/header-injection.express.plugin.spec.js index 655d6921e95..bdb9734377a 100644 --- a/packages/dd-trace/test/appsec/iast/analyzers/header-injection.express.plugin.spec.js +++ b/packages/dd-trace/test/appsec/iast/analyzers/header-injection.express.plugin.spec.js @@ -242,7 +242,7 @@ describe('Header injection vulnerability', () => { testThatRequestHasNoVulnerability({ fn: (req, res) => { - setHeaderFunction('Access-Control-Allow-Origin', req.headers['origin'], res) + setHeaderFunction('Access-Control-Allow-Origin', req.headers.origin, res) setHeaderFunction('Access-Control-Allow-Headers', req.headers['access-control-request-headers'], res) setHeaderFunction('Access-Control-Allow-Methods', req.headers['access-control-request-methods'], res) }, @@ -263,7 +263,7 @@ describe('Header injection vulnerability', () => { makeRequest: (done, config) => { return axios.options(`http://localhost:${config.port}/`, { headers: { - 'origin': 'http://custom-origin', + origin: 'http://custom-origin', 'Access-Control-Request-Headers': 'TestHeader', 'Access-Control-Request-Methods': 'GET' } diff --git a/packages/dd-trace/test/appsec/iast/analyzers/path-traversal-analyzer.spec.js b/packages/dd-trace/test/appsec/iast/analyzers/path-traversal-analyzer.spec.js index 216d63514cc..706d07cda14 100644 --- a/packages/dd-trace/test/appsec/iast/analyzers/path-traversal-analyzer.spec.js +++ b/packages/dd-trace/test/appsec/iast/analyzers/path-traversal-analyzer.spec.js @@ -273,7 +273,7 @@ prepareTestServerForIast('integration test', (testThatRequestHasVulnerability, t } describe('test createReadStream', () => { - runFsMethodTest(`test fs.createReadStream method`, 0, (args) => { + runFsMethodTest('test fs.createReadStream method', 0, (args) => { const rs = fs.createReadStream(...args) rs.close() }, __filename) @@ -288,7 +288,7 @@ prepareTestServerForIast('integration test', (testThatRequestHasVulnerability, t fs.unlinkSync(filepath) }) - runFsMethodTest(`test fs.createWriteStream method`, 0, (args) => { + runFsMethodTest('test fs.createWriteStream method', 0, (args) => { const rs = fs.createWriteStream(...args) return new Promise((resolve, reject) => { rs.close((err) => { @@ -393,7 +393,7 @@ prepareTestServerForIast('integration test', (testThatRequestHasVulnerability, t describe('test realpath', () => { runFsMethodTestThreeWay('realpath', 0, null, __filename) - runFsMethodTest(`test fs.realpath.native method`, 0, (args) => { + runFsMethodTest('test fs.realpath.native method', 0, (args) => { fs.realpath.native(...args, () => {}) }, __filename) }) @@ -472,7 +472,7 @@ prepareTestServerForIast('integration test', (testThatRequestHasVulnerability, t beforeEach(() => { fs.watchFile(__filename, listener) }) - runFsMethodTest(`test fs.watchFile method`, 0, (args) => { + runFsMethodTest('test fs.watchFile method', 0, (args) => { fs.unwatchFile(...args) }, __filename, listener) }) @@ -486,7 +486,7 @@ prepareTestServerForIast('integration test', (testThatRequestHasVulnerability, t }) describe('test watch', () => { - runFsMethodTest(`test fs.watch method`, 0, (args) => { + runFsMethodTest('test fs.watch method', 0, (args) => { const watcher = fs.watch(...args, () => {}) watcher.close() }, __filename) @@ -497,7 +497,7 @@ prepareTestServerForIast('integration test', (testThatRequestHasVulnerability, t afterEach(() => { fs.unwatchFile(__filename, listener) }) - runFsMethodTest(`test fs.watchFile method`, 0, (args) => { + runFsMethodTest('test fs.watchFile method', 0, (args) => { fs.watchFile(...args, listener) }, __filename) }) diff --git a/packages/dd-trace/test/appsec/iast/analyzers/resources/fs-async-way-method.js b/packages/dd-trace/test/appsec/iast/analyzers/resources/fs-async-way-method.js index 16a599b295c..ef0bcc0d608 100644 --- a/packages/dd-trace/test/appsec/iast/analyzers/resources/fs-async-way-method.js +++ b/packages/dd-trace/test/appsec/iast/analyzers/resources/fs-async-way-method.js @@ -4,6 +4,7 @@ const fs = require('fs') module.exports = function (methodName, args, cb) { return new Promise((resolve, reject) => { + // eslint-disable-next-line n/handle-callback-err fs[methodName](...args, (err, res) => { resolve(cb(res)) }) diff --git a/packages/dd-trace/test/appsec/iast/analyzers/sql-injection-analyzer.spec.js b/packages/dd-trace/test/appsec/iast/analyzers/sql-injection-analyzer.spec.js index 8b93f492e62..7716f0ae478 100644 --- a/packages/dd-trace/test/appsec/iast/analyzers/sql-injection-analyzer.spec.js +++ b/packages/dd-trace/test/appsec/iast/analyzers/sql-injection-analyzer.spec.js @@ -172,12 +172,12 @@ describe('sql-injection-analyzer', () => { const sqlInjectionAnalyzer = require('../../../../src/appsec/iast/analyzers/sql-injection-analyzer') const knexDialects = { - 'mssql': 'MSSQL', - 'oracle': 'ORACLE', - 'mysql': 'MYSQL', - 'redshift': 'REDSHIFT', - 'postgresql': 'POSTGRES', - 'sqlite3': 'SQLITE' + mssql: 'MSSQL', + oracle: 'ORACLE', + mysql: 'MYSQL', + redshift: 'REDSHIFT', + postgresql: 'POSTGRES', + sqlite3: 'SQLITE' } Object.keys(knexDialects).forEach((knexDialect) => { diff --git a/packages/dd-trace/test/appsec/iast/iast-plugin.spec.js b/packages/dd-trace/test/appsec/iast/iast-plugin.spec.js index 2bb54138da8..1c3af349794 100644 --- a/packages/dd-trace/test/appsec/iast/iast-plugin.spec.js +++ b/packages/dd-trace/test/appsec/iast/iast-plugin.spec.js @@ -37,6 +37,7 @@ describe('IAST Plugin', () => { addSub (channelName, handler) { addSubMock(channelName, handler) } + configure (config) { configureMock(config) } @@ -54,7 +55,7 @@ describe('IAST Plugin', () => { errorAndPublish: logError }, './iast-context': { - getIastContext: getIastContext + getIastContext }, './telemetry': { isEnabled: () => false @@ -194,6 +195,7 @@ describe('IAST Plugin', () => { addSub (channelName, handler) { addSubMock(channelName, handler) } + configure (config) { configureMock(config) } @@ -340,7 +342,7 @@ describe('IAST Plugin', () => { iastPlugin.addSub({ moduleName: 'source', channelName: 'datadog:source:start', - tag: [ 'http.source', 'http.source2', 'http.source3' ], + tag: ['http.source', 'http.source2', 'http.source3'], tagKey: SOURCE_TYPE }, handler) iastPlugin.configure(true) diff --git a/packages/dd-trace/test/appsec/iast/path-line.spec.js b/packages/dd-trace/test/appsec/iast/path-line.spec.js index 6dd5f9a77d7..f9a629c5170 100644 --- a/packages/dd-trace/test/appsec/iast/path-line.spec.js +++ b/packages/dd-trace/test/appsec/iast/path-line.spec.js @@ -9,12 +9,15 @@ class CallSiteMock { this.lineNumber = lineNumber this.columnNumber = columnNumber } + getLineNumber () { return this.lineNumber } + getColumnNumber () { return this.columnNumber } + getFileName () { return this.fileName } @@ -41,8 +44,8 @@ describe('path-line', function () { mockPath = {} mockProcess = {} pathLine = proxyquire('../../../src/appsec/iast/path-line', { - 'path': mockPath, - 'process': mockProcess + path: mockPath, + process: mockProcess }) }) describe('getFirstNonDDPathAndLine', () => { diff --git a/packages/dd-trace/test/appsec/iast/taint-tracking/taint-tracking-impl.spec.js b/packages/dd-trace/test/appsec/iast/taint-tracking/taint-tracking-impl.spec.js index 409abd5d060..3ee9a63e841 100644 --- a/packages/dd-trace/test/appsec/iast/taint-tracking/taint-tracking-impl.spec.js +++ b/packages/dd-trace/test/appsec/iast/taint-tracking/taint-tracking-impl.spec.js @@ -91,8 +91,8 @@ describe('TaintTracking', () => { const json = '{"command":"ls -la"}' const jsonTainted = newTaintedString(iastContext, json, 'param', 'request.type') - const propFnInstrumented = require(instrumentedFunctionsFile)['jsonParseStr'] - const propFnOriginal = propagationFunctions['jsonParseStr'] + const propFnInstrumented = require(instrumentedFunctionsFile).jsonParseStr + const propFnOriginal = propagationFunctions.jsonParseStr const result = propFnInstrumented(jsonTainted) expect(isTainted(iastContext, result.command)).to.be.true diff --git a/packages/dd-trace/test/appsec/iast/utils.js b/packages/dd-trace/test/appsec/iast/utils.js index e34adb3ecd7..ad40fd8e892 100644 --- a/packages/dd-trace/test/appsec/iast/utils.js +++ b/packages/dd-trace/test/appsec/iast/utils.js @@ -296,14 +296,14 @@ function prepareTestServerForIastInExpress (description, expressVersion, loadMid before((done) => { const express = require(`../../../../../versions/express@${expressVersion}`).get() - const bodyParser = require(`../../../../../versions/body-parser`).get() + const bodyParser = require('../../../../../versions/body-parser').get() const expressApp = express() if (loadMiddlewares) loadMiddlewares(expressApp) expressApp.use(bodyParser.json()) try { - const cookieParser = require(`../../../../../versions/cookie-parser`).get() + const cookieParser = require('../../../../../versions/cookie-parser').get() expressApp.use(cookieParser()) } catch (e) { // do nothing, in some scenarios we don't have cookie-parser dependency available, and we don't need diff --git a/packages/dd-trace/test/appsec/iast/vulnerability-formatter/utils.spec.js b/packages/dd-trace/test/appsec/iast/vulnerability-formatter/utils.spec.js index a22d5390c7c..c674fc35c9e 100644 --- a/packages/dd-trace/test/appsec/iast/vulnerability-formatter/utils.spec.js +++ b/packages/dd-trace/test/appsec/iast/vulnerability-formatter/utils.spec.js @@ -81,7 +81,7 @@ describe('test vulnerabiilty-formatter utils', () => { const range = { start: 0, end: 5, iinfo } - const { value, ranges } = stringifyWithRanges(src, { '0': [range] }) + const { value, ranges } = stringifyWithRanges(src, { 0: [range] }) expect(value).to.be.equal(JSON.stringify(src, null, 2)) @@ -108,8 +108,8 @@ describe('test vulnerabiilty-formatter utils', () => { const iinfo = { type: 'TEST' } const objRanges = { '0.key': [{ start: 0, end: 8, iinfo }], - '1': [{ start: 0, end: 8, iinfo }], - '2': [ + 1: [{ start: 0, end: 8, iinfo }], + 2: [ { start: 3, end: 7, iinfo }, { start: 8, end: 10, iinfo } ], @@ -320,7 +320,7 @@ describe('test vulnerabiilty-formatter utils', () => { start: 0, end: 5, iinfo } - const { value, ranges, sensitiveRanges } = stringifyWithRanges(src, { '0': [range] }, true) + const { value, ranges, sensitiveRanges } = stringifyWithRanges(src, { 0: [range] }, true) expect(value).to.be.equal(JSON.stringify(src, null, 2)) @@ -351,8 +351,8 @@ describe('test vulnerabiilty-formatter utils', () => { const iinfo = { type: 'TEST' } const objRanges = { '0.key': [{ start: 0, end: 8, iinfo }], - '1': [{ start: 0, end: 8, iinfo }], - '2': [ + 1: [{ start: 0, end: 8, iinfo }], + 2: [ { start: 3, end: 7, iinfo }, { start: 8, end: 10, iinfo } ], diff --git a/packages/dd-trace/test/appsec/index.express.plugin.spec.js b/packages/dd-trace/test/appsec/index.express.plugin.spec.js index 811d4ef5291..5bfd37bf75a 100644 --- a/packages/dd-trace/test/appsec/index.express.plugin.spec.js +++ b/packages/dd-trace/test/appsec/index.express.plugin.spec.js @@ -118,7 +118,7 @@ withVersions('express', 'express', version => { } it('should get the request body schema', async () => { - const expectedRequestBodySchema = formatSchema([{ 'key': [8] }]) + const expectedRequestBodySchema = formatSchema([{ key: [8] }]) const res = await axios.post(`http://localhost:${port}/`, { key: 'value' }) await agent.use((traces) => { @@ -133,7 +133,7 @@ withVersions('express', 'express', version => { }) it('should get the response body schema with res.send method with object', async () => { - const expectedResponseBodySchema = formatSchema([{ 'sendResKey': [8] }]) + const expectedResponseBodySchema = formatSchema([{ sendResKey: [8] }]) const res = await axios.post(`http://localhost:${port}/sendjson`, { key: 'value' }) await agent.use((traces) => { @@ -146,7 +146,7 @@ withVersions('express', 'express', version => { }) it('should get the response body schema with res.json method', async () => { - const expectedResponseBodySchema = formatSchema([{ 'jsonResKey': [8] }]) + const expectedResponseBodySchema = formatSchema([{ jsonResKey: [8] }]) const res = await axios.post(`http://localhost:${port}/json`, { key: 'value' }) await agent.use((traces) => { @@ -159,7 +159,7 @@ withVersions('express', 'express', version => { }) it('should get the response body schema with res.jsonp method', async () => { - const expectedResponseBodySchema = formatSchema([{ 'jsonpResKey': [8] }]) + const expectedResponseBodySchema = formatSchema([{ jsonpResKey: [8] }]) const res = await axios.post(`http://localhost:${port}/jsonp`, { key: 'value' }) await agent.use((traces) => { diff --git a/packages/dd-trace/test/appsec/index.next.plugin.spec.js b/packages/dd-trace/test/appsec/index.next.plugin.spec.js index 9cc23a6c18e..4858f9c9ebd 100644 --- a/packages/dd-trace/test/appsec/index.next.plugin.spec.js +++ b/packages/dd-trace/test/appsec/index.next.plugin.spec.js @@ -12,7 +12,8 @@ const { DD_MAJOR, NODE_MAJOR } = require('../../../../version') const agent = require('../plugins/agent') const BUILD_COMMAND = NODE_MAJOR < 18 - ? 'yarn exec next build' : 'NODE_OPTIONS=--openssl-legacy-provider yarn exec next build' + ? 'yarn exec next build' + : 'NODE_OPTIONS=--openssl-legacy-provider yarn exec next build' let VERSIONS_TO_TEST = NODE_MAJOR < 18 ? '>=11.1 <13.2' : '>=11.1' VERSIONS_TO_TEST = DD_MAJOR >= 4 ? VERSIONS_TO_TEST : '>=9.5 <11.1' @@ -23,7 +24,7 @@ describe('test suite', () => { const satisfiesStandalone = version => satisfies(version, '>=12.0.0') withVersions('next', 'next', VERSIONS_TO_TEST, version => { - const realVersion = require(`${__dirname}/../../../../versions/next@${version}`).version() + const realVersion = require(`../../../../versions/next@${version}`).version() function initApp (appName) { const appDir = path.join(__dirname, 'next', appName) @@ -33,7 +34,7 @@ describe('test suite', () => { const cwd = appDir - const pkg = require(`${__dirname}/../../../../versions/next@${version}/package.json`) + const pkg = require(`../../../../versions/next@${version}/package.json`) if (realVersion.startsWith('10')) { return this.skip() // TODO: Figure out why 10.x tests fail. diff --git a/packages/dd-trace/test/appsec/index.spec.js b/packages/dd-trace/test/appsec/index.spec.js index ef8c9829eb4..febd54244a6 100644 --- a/packages/dd-trace/test/appsec/index.spec.js +++ b/packages/dd-trace/test/appsec/index.spec.js @@ -246,7 +246,7 @@ describe('AppSec Index', () => { url: '/path', headers: { 'user-agent': 'Arachni', - 'host': 'localhost', + host: 'localhost', cookie: 'a=1;b=2' }, method: 'POST', @@ -293,7 +293,7 @@ describe('AppSec Index', () => { url: '/path', headers: { 'user-agent': 'Arachni', - 'host': 'localhost', + host: 'localhost', cookie: 'a=1;b=2' }, method: 'POST', @@ -331,7 +331,7 @@ describe('AppSec Index', () => { url: '/path', headers: { 'user-agent': 'Arachni', - 'host': 'localhost', + host: 'localhost', cookie: 'a=1;b=2' }, method: 'POST', @@ -374,7 +374,7 @@ describe('AppSec Index', () => { url: '/path', headers: { 'user-agent': 'Arachni', - 'host': 'localhost', + host: 'localhost', cookie: 'a=1;b=2' }, method: 'POST', @@ -449,7 +449,7 @@ describe('AppSec Index', () => { url: '/path', headers: { 'user-agent': 'Arachni', - 'host': 'localhost', + host: 'localhost', cookie: 'a=1;b=2' }, method: 'POST', @@ -484,7 +484,7 @@ describe('AppSec Index', () => { url: '/path', headers: { 'user-agent': 'Arachni', - 'host': 'localhost', + host: 'localhost', cookie: 'a=1;b=2' }, method: 'POST', @@ -519,7 +519,7 @@ describe('AppSec Index', () => { url: '/path', headers: { 'user-agent': 'Arachni', - 'host': 'localhost', + host: 'localhost', cookie: 'a=1;b=2' }, method: 'POST', @@ -606,7 +606,7 @@ describe('AppSec Index', () => { url: '/path', headers: { 'user-agent': 'Arachni', - 'host': 'localhost' + host: 'localhost' }, method: 'POST', socket: { @@ -960,7 +960,7 @@ describe('IP blocking', () => { await axios.get(`http://localhost:${port}/`, { headers: { [ipHeader]: invalidIp, - 'Accept': '*/*' + Accept: '*/*' } }).catch((err) => { expect(err.response.status).to.be.equal(403) @@ -972,7 +972,7 @@ describe('IP blocking', () => { await axios.get(`http://localhost:${port}/`, { headers: { [ipHeader]: invalidIp, - 'Accept': 'text/html' + Accept: 'text/html' } }).catch((err) => { expect(err.response.status).to.be.equal(403) @@ -1030,7 +1030,7 @@ describe('IP blocking', () => { return axios.get(`http://localhost:${port}/`, { headers: { 'x-forwarded-for': invalidIp, - 'Accept': 'text/html' + Accept: 'text/html' } }).then(() => { throw new Error('Not expected') diff --git a/packages/dd-trace/test/appsec/next/pages-dir/server.js b/packages/dd-trace/test/appsec/next/pages-dir/server.js index 673974ac988..c7cfda1abff 100644 --- a/packages/dd-trace/test/appsec/next/pages-dir/server.js +++ b/packages/dd-trace/test/appsec/next/pages-dir/server.js @@ -3,6 +3,7 @@ const { PORT, HOSTNAME } = process.env const { createServer } = require('http') +// eslint-disable-next-line n/no-deprecated-api const { parse } = require('url') const next = require('next') // eslint-disable-line import/no-extraneous-dependencies diff --git a/packages/dd-trace/test/appsec/reporter.spec.js b/packages/dd-trace/test/appsec/reporter.spec.js index 94f778d4fd0..05be9f80c7f 100644 --- a/packages/dd-trace/test/appsec/reporter.spec.js +++ b/packages/dd-trace/test/appsec/reporter.spec.js @@ -293,7 +293,7 @@ describe('reporter', () => { }) it('should call addTags', () => { - const schemaValue = [{ 'key': [8] }] + const schemaValue = [{ key: [8] }] const derivatives = { '_dd.appsec.s.req.headers': schemaValue, '_dd.appsec.s.req.query': schemaValue, diff --git a/packages/dd-trace/test/appsec/rule_manager.spec.js b/packages/dd-trace/test/appsec/rule_manager.spec.js index 7c9dc010ddc..e7daca53341 100644 --- a/packages/dd-trace/test/appsec/rule_manager.spec.js +++ b/packages/dd-trace/test/appsec/rule_manager.spec.js @@ -290,16 +290,16 @@ describe('AppSec Rule Manager', () => { it('should apply new rules', () => { const testRules = { version: '2.2', - metadata: { 'rules_version': '1.5.0' }, + metadata: { rules_version: '1.5.0' }, rules: [{ - 'id': 'test-id', - 'name': 'test-name', - 'tags': { - 'type': 'security_scanner', - 'category': 'attack_attempt', - 'confidence': '1' + id: 'test-id', + name: 'test-name', + tags: { + type: 'security_scanner', + category: 'attack_attempt', + confidence: '1' }, - 'conditions': [] + conditions: [] }], processors: [{ id: 'test-processor-id', @@ -350,16 +350,16 @@ describe('AppSec Rule Manager', () => { } const testRules = { version: '2.2', - metadata: { 'rules_version': '1.5.0' }, + metadata: { rules_version: '1.5.0' }, rules: [{ - 'id': 'test-id', - 'name': 'test-name', - 'tags': { - 'type': 'security_scanner', - 'category': 'attack_attempt', - 'confidence': '1' + id: 'test-id', + name: 'test-name', + tags: { + type: 'security_scanner', + category: 'attack_attempt', + confidence: '1' }, - 'conditions': [] + conditions: [] }], processors: [{ id: 'test-processor-id', @@ -413,14 +413,14 @@ describe('AppSec Rule Manager', () => { id: 'rules1', file: { version: '2.2', - metadata: { 'rules_version': '1.5.0' }, + metadata: { rules_version: '1.5.0' }, rules: [{ - 'id': 'test-id', - 'name': 'test-name', - 'tags': { - 'type': 'security_scanner', - 'category': 'attack_attempt', - 'confidence': '1' + id: 'test-id', + name: 'test-name', + tags: { + type: 'security_scanner', + category: 'attack_attempt', + confidence: '1' }, conditions: [ { @@ -442,14 +442,14 @@ describe('AppSec Rule Manager', () => { id: 'rules2', file: { version: '2.2', - metadata: { 'rules_version': '1.5.0' }, + metadata: { rules_version: '1.5.0' }, rules: [{ - 'id': 'test-id', - 'name': 'test-name', - 'tags': { - 'type': 'security_scanner', - 'category': 'attack_attempt', - 'confidence': '1' + id: 'test-id', + name: 'test-name', + tags: { + type: 'security_scanner', + category: 'attack_attempt', + confidence: '1' }, conditions: [ { @@ -480,13 +480,13 @@ describe('AppSec Rule Manager', () => { describe('ASM', () => { it('should apply both rules_override and exclusions', () => { const asm = { - 'exclusions': [{ + exclusions: [{ ekey: 'eValue' }], - 'rules_override': [{ + rules_override: [{ roKey: 'roValue' }], - 'custom_rules': [{ + custom_rules: [{ piKey: 'piValue' }] } @@ -575,13 +575,13 @@ describe('AppSec Rule Manager', () => { it('should ignore other properties', () => { const asm = { - 'exclusions': [{ + exclusions: [{ ekey: 'eValue' }], - 'rules_override': [{ + rules_override: [{ roKey: 'roValue' }], - 'not_supported': [{ + not_supported: [{ nsKey: 'nsValue' }] } @@ -597,8 +597,8 @@ describe('AppSec Rule Manager', () => { updateWafFromRC({ toUnapply: [], toApply, toModify: [] }) expect(waf.update).to.have.been.calledOnceWithExactly({ - 'exclusions': asm['exclusions'], - 'rules_override': asm['rules_override'] + exclusions: asm.exclusions, + rules_override: asm.rules_override }) }) }) diff --git a/packages/dd-trace/test/appsec/waf/index.spec.js b/packages/dd-trace/test/appsec/waf/index.spec.js index bcdfcf5cb79..56676f1ccdd 100644 --- a/packages/dd-trace/test/appsec/waf/index.spec.js +++ b/packages/dd-trace/test/appsec/waf/index.spec.js @@ -77,8 +77,8 @@ describe('WAF Manager', () => { loaded: ['rule_1'], failed: ['rule_2', 'rule_3'], errors: { - 'error_1': ['invalid_1'], - 'error_2': ['invalid_2', 'invalid_3'] + error_1: ['invalid_1'], + error_2: ['invalid_2', 'invalid_3'] } } } @@ -124,7 +124,7 @@ describe('WAF Manager', () => { it('should call ddwaf.update', () => { const rules = { - 'rules_data': [ + rules_data: [ { id: 'blocked_users', type: 'data_with_expiration', @@ -145,7 +145,7 @@ describe('WAF Manager', () => { it('should call Reporter.reportWafUpdate', () => { const rules = { - 'rules_data': [ + rules_data: [ { id: 'blocked_users', type: 'data_with_expiration', @@ -174,7 +174,7 @@ describe('WAF Manager', () => { url: '/path', headers: { 'user-agent': 'Arachni', - 'host': 'localhost', + host: 'localhost', cookie: 'a=1;b=2' }, method: 'POST', @@ -215,7 +215,7 @@ describe('WAF Manager', () => { wafContextWrapper.run({ persistent: { - 'server.request.headers.no_cookies': { 'header': 'value' }, + 'server.request.headers.no_cookies': { header: 'value' }, 'server.request.uri.raw': 'https://testurl', 'processor.address': { 'extract-schema': true } } @@ -223,7 +223,7 @@ describe('WAF Manager', () => { expect(ddwafContext.run).to.be.calledOnceWithExactly({ persistent: { - 'server.request.headers.no_cookies': { 'header': 'value' }, + 'server.request.headers.no_cookies': { header: 'value' }, 'server.request.uri.raw': 'https://testurl', 'processor.address': { 'extract-schema': true } } @@ -240,7 +240,7 @@ describe('WAF Manager', () => { ddwafContext.run.returns(result) const params = { persistent: { - 'server.request.headers.no_cookies': { 'header': 'value' } + 'server.request.headers.no_cookies': { header: 'value' } } } @@ -259,7 +259,7 @@ describe('WAF Manager', () => { ddwafContext.run.returns(result) const params = { persistent: { - 'server.request.headers.no_cookies': { 'header': 'value' } + 'server.request.headers.no_cookies': { header: 'value' } } } @@ -275,7 +275,7 @@ describe('WAF Manager', () => { ddwafContext.run.returns({ totalRuntime: 1, durationExt: 1 }) const params = { persistent: { - 'server.request.headers.no_cookies': { 'header': 'value' } + 'server.request.headers.no_cookies': { header: 'value' } } } @@ -288,7 +288,7 @@ describe('WAF Manager', () => { ddwafContext.run.returns({ totalRuntime: 1, durationExt: 1, events: [] }) const params = { persistent: { - 'server.request.headers.no_cookies': { 'header': 'value' } + 'server.request.headers.no_cookies': { header: 'value' } } } @@ -299,11 +299,11 @@ describe('WAF Manager', () => { it('should return the actions', () => { const actions = ['block'] - ddwafContext.run.returns({ totalRuntime: 1, durationExt: 1, events: [], actions: actions }) + ddwafContext.run.returns({ totalRuntime: 1, durationExt: 1, events: [], actions }) const params = { persistent: { - 'server.request.headers.no_cookies': { 'header': 'value' } + 'server.request.headers.no_cookies': { header: 'value' } } } diff --git a/packages/dd-trace/test/ci-visibility/exporters/ci-visibility-exporter.spec.js b/packages/dd-trace/test/ci-visibility/exporters/ci-visibility-exporter.spec.js index 36d8483fb0e..20ef2e29681 100644 --- a/packages/dd-trace/test/ci-visibility/exporters/ci-visibility-exporter.spec.js +++ b/packages/dd-trace/test/ci-visibility/exporters/ci-visibility-exporter.spec.js @@ -143,7 +143,7 @@ describe('CI Visibility Exporter', () => { ciVisibilityExporter.getLibraryConfiguration({}, () => { expect(scope.isDone()).to.be.true expect(customConfig).to.eql({ - 'my_custom_config': 'my_custom_config_value' + my_custom_config: 'my_custom_config_value' }) done() }) @@ -362,7 +362,7 @@ describe('CI Visibility Exporter', () => { ciVisibilityExporter.getSkippableSuites({}, () => { expect(scope.isDone()).to.be.true expect(customConfig).to.eql({ - 'my_custom_config_2': 'my_custom_config_value_2' + my_custom_config_2: 'my_custom_config_value_2' }) done() }) @@ -690,9 +690,9 @@ describe('CI Visibility Exporter', () => { data: { attributes: { tests: { - 'jest': { - 'suite1': ['test1'], - 'suite2': ['test2'] + jest: { + suite1: ['test1'], + suite2: ['test2'] } } } @@ -706,9 +706,9 @@ describe('CI Visibility Exporter', () => { ciVisibilityExporter.getKnownTests({}, (err, knownTests) => { expect(err).to.be.null expect(knownTests).to.eql({ - 'jest': { - 'suite1': ['test1'], - 'suite2': ['test2'] + jest: { + suite1: ['test1'], + suite2: ['test2'] } }) expect(scope.isDone()).to.be.true @@ -740,9 +740,9 @@ describe('CI Visibility Exporter', () => { data: { attributes: { tests: { - 'jest': { - 'suite1': ['test1'], - 'suite2': ['test2'] + jest: { + suite1: ['test1'], + suite2: ['test2'] } } } @@ -760,9 +760,9 @@ describe('CI Visibility Exporter', () => { ciVisibilityExporter.getKnownTests({}, (err, knownTests) => { expect(err).to.be.null expect(knownTests).to.eql({ - 'jest': { - 'suite1': ['test1'], - 'suite2': ['test2'] + jest: { + suite1: ['test1'], + suite2: ['test2'] } }) expect(scope.isDone()).to.be.true @@ -781,9 +781,9 @@ describe('CI Visibility Exporter', () => { data: { attributes: { tests: { - 'jest': { - 'suite1': ['test1'], - 'suite2': ['test2'] + jest: { + suite1: ['test1'], + suite2: ['test2'] } } } @@ -801,9 +801,9 @@ describe('CI Visibility Exporter', () => { ciVisibilityExporter.getKnownTests({}, (err, knownTests) => { expect(err).to.be.null expect(knownTests).to.eql({ - 'jest': { - 'suite1': ['test1'], - 'suite2': ['test2'] + jest: { + suite1: ['test1'], + suite2: ['test2'] } }) expect(scope.isDone()).to.be.true diff --git a/packages/dd-trace/test/config.spec.js b/packages/dd-trace/test/config.spec.js index e7792ab7a36..6414e2f32d1 100644 --- a/packages/dd-trace/test/config.spec.js +++ b/packages/dd-trace/test/config.spec.js @@ -335,7 +335,7 @@ describe('Config', () => { expect(config).to.have.property('spanRemoveIntegrationFromService', true) expect(config).to.have.property('spanComputePeerService', true) expect(config.tags).to.include({ foo: 'bar', baz: 'qux' }) - expect(config.tags).to.include({ service: 'service', 'version': '1.0.0', 'env': 'test' }) + expect(config.tags).to.include({ service: 'service', version: '1.0.0', env: 'test' }) expect(config).to.have.deep.nested.property('sampler', { sampleRate: 0.5, rateLimit: '-1', @@ -502,7 +502,7 @@ describe('Config', () => { it('should initialize from the options', () => { const logger = {} const tags = { - 'foo': 'bar' + foo: 'bar' } const logLevel = 'error' const config = new Config({ @@ -552,7 +552,7 @@ describe('Config', () => { runtimeMetrics: true, reportHostname: true, plugins: false, - logLevel: logLevel, + logLevel, tracePropagationStyle: { inject: ['datadog'], extract: ['datadog'] diff --git a/packages/dd-trace/test/datastreams/writer.spec.js b/packages/dd-trace/test/datastreams/writer.spec.js index 4cfd4dd87e6..0d4d7875629 100644 --- a/packages/dd-trace/test/datastreams/writer.spec.js +++ b/packages/dd-trace/test/datastreams/writer.spec.js @@ -14,7 +14,7 @@ const stubZlib = { const { DataStreamsWriter } = proxyquire( '../src/datastreams/writer', { '../exporters/common/request': stubRequest, - 'zlib': stubZlib + zlib: stubZlib }) describe('DataStreamWriter unix', () => { diff --git a/packages/dd-trace/test/dogstatsd.spec.js b/packages/dd-trace/test/dogstatsd.spec.js index f210fd17d3a..8c1af9f5494 100644 --- a/packages/dd-trace/test/dogstatsd.spec.js +++ b/packages/dd-trace/test/dogstatsd.spec.js @@ -63,8 +63,8 @@ describe('dogstatsd', () => { }) const dogstatsd = proxyquire('../src/dogstatsd', { - 'dgram': dgram, - 'dns': dns + dgram, + dns }) DogStatsDClient = dogstatsd.DogStatsDClient CustomMetrics = dogstatsd.CustomMetrics @@ -337,7 +337,7 @@ describe('dogstatsd', () => { // host exists but port does not, ECONNREFUSED client = new DogStatsDClient({ - metricsProxyUrl: `http://localhost:32700`, + metricsProxyUrl: 'http://localhost:32700', host: 'localhost', port: 8125 }) diff --git a/packages/dd-trace/test/encode/0.4.spec.js b/packages/dd-trace/test/encode/0.4.spec.js index 5ff1bc96fa9..812053972bb 100644 --- a/packages/dd-trace/test/encode/0.4.spec.js +++ b/packages/dd-trace/test/encode/0.4.spec.js @@ -193,7 +193,7 @@ describe('encode', () => { const traceIdVal = `${rootTid}${rootT64}` const encodedLink = `[{"trace_id":"${traceIdVal}","span_id":"1234abcd1234abcd",` + - `"attributes":{"foo":"bar"},"tracestate":"dd=s:-1;o:foo;t.dm:-4;t.usr.id:bar","flags":1}]` + '"attributes":{"foo":"bar"},"tracestate":"dd=s:-1;o:foo;t.dm:-4;t.usr.id:bar","flags":1}]' data[0].meta['_dd.span_links'] = encodedLink diff --git a/packages/dd-trace/test/encode/0.5.spec.js b/packages/dd-trace/test/encode/0.5.spec.js index 45f4c972d42..94a8efbbb5c 100644 --- a/packages/dd-trace/test/encode/0.5.spec.js +++ b/packages/dd-trace/test/encode/0.5.spec.js @@ -73,7 +73,7 @@ describe('encode 0.5', () => { const traceIdVal = `${rootTid}${rootT64}` const encodedLink = `[{"trace_id":"${traceIdVal}","span_id":"1234abcd1234abcd",` + - `"attributes":{"foo":"bar"},"tracestate":"dd=s:-1;o:foo;t.dm:-4;t.usr.id:bar","flags":1}]` + '"attributes":{"foo":"bar"},"tracestate":"dd=s:-1;o:foo;t.dm:-4;t.usr.id:bar","flags":1}]' data[0].meta['_dd.span_links'] = encodedLink diff --git a/packages/dd-trace/test/exporters/common/request.spec.js b/packages/dd-trace/test/exporters/common/request.spec.js index eb606fd468e..57da6ee9b99 100644 --- a/packages/dd-trace/test/exporters/common/request.spec.js +++ b/packages/dd-trace/test/exporters/common/request.spec.js @@ -163,6 +163,7 @@ describe('request', function () { hostname: 'test', port: 123, path: '/' + // eslint-disable-next-line n/handle-callback-err }, (err, res) => { expect(res).to.equal('OK') }) @@ -178,6 +179,7 @@ describe('request', function () { request(Buffer.from(''), { path: '/path', method: 'PUT' + // eslint-disable-next-line n/handle-callback-err }, (err, res) => { expect(res).to.equal('OK') done() @@ -214,6 +216,7 @@ describe('request', function () { request(form, { path: '/path', method: 'PUT' + // eslint-disable-next-line n/handle-callback-err }, (err, res) => { expect(res).to.equal('OK') done() @@ -243,6 +246,7 @@ describe('request', function () { hostname: 'localhost', protocol: 'http:', port: port2 + // eslint-disable-next-line n/handle-callback-err }, (err, res) => { expect(res).to.equal('OK') shutdownFirst() diff --git a/packages/dd-trace/test/format.spec.js b/packages/dd-trace/test/format.spec.js index 37306d46b15..b75c73d99a7 100644 --- a/packages/dd-trace/test/format.spec.js +++ b/packages/dd-trace/test/format.spec.js @@ -342,7 +342,7 @@ describe('format', () => { it('should extract errors', () => { const error = new Error('boom') - spanContext._tags['error'] = error + spanContext._tags.error = error trace = format(span) expect(trace.meta[ERROR_MESSAGE]).to.equal(error.message) @@ -355,7 +355,7 @@ describe('format', () => { error.name = null error.stack = null - spanContext._tags['error'] = error + spanContext._tags.error = error trace = format(span) expect(trace.meta[ERROR_MESSAGE]).to.equal(error.message) @@ -374,12 +374,12 @@ describe('format', () => { it('should add the language tag for a basic span', () => { trace = format(span) - expect(trace.meta['language']).to.equal('javascript') + expect(trace.meta.language).to.equal('javascript') }) describe('when there is an `error` tag ', () => { it('should set the error flag when error tag is true', () => { - spanContext._tags['error'] = true + spanContext._tags.error = true trace = format(span) @@ -387,7 +387,7 @@ describe('format', () => { }) it('should not set the error flag when error is false', () => { - spanContext._tags['error'] = false + spanContext._tags.error = false trace = format(span) @@ -395,11 +395,11 @@ describe('format', () => { }) it('should not extract error to meta', () => { - spanContext._tags['error'] = true + spanContext._tags.error = true trace = format(span) - expect(trace.meta['error']).to.be.undefined + expect(trace.meta.error).to.be.undefined }) }) @@ -425,7 +425,7 @@ describe('format', () => { }) it('should not set the error flag for internal spans with error tag', () => { - spanContext._tags['error'] = new Error('boom') + spanContext._tags.error = new Error('boom') spanContext._name = 'fs.operation' trace = format(span) @@ -467,7 +467,7 @@ describe('format', () => { num: '1' } - spanContext._tags['nested'] = tag + spanContext._tags.nested = tag trace = format(span) expect(trace.meta['nested.num']).to.equal('1') @@ -525,8 +525,8 @@ describe('format', () => { it('should not crash on prototype-free tags objects when nesting', () => { const tags = Object.create(null) - tags['nested'] = { foo: 'bar' } - spanContext._tags['nested'] = tags + tags.nested = { foo: 'bar' } + spanContext._tags.nested = tags format(span) }) diff --git a/packages/dd-trace/test/id.spec.js b/packages/dd-trace/test/id.spec.js index 4be8e752402..61d4dd5e054 100644 --- a/packages/dd-trace/test/id.spec.js +++ b/packages/dd-trace/test/id.spec.js @@ -25,7 +25,7 @@ describe('id', () => { sinon.stub(Math, 'random') id = proxyquire('../src/id', { - 'crypto': crypto + crypto }) }) diff --git a/packages/dd-trace/test/lambda/index.spec.js b/packages/dd-trace/test/lambda/index.spec.js index 8d22949dd76..679813407eb 100644 --- a/packages/dd-trace/test/lambda/index.spec.js +++ b/packages/dd-trace/test/lambda/index.spec.js @@ -209,7 +209,7 @@ describe('lambda', () => { return closeAgent() }) - it(`doesnt crash when spans are finished early and reached impending timeout`, async () => { + it('doesnt crash when spans are finished early and reached impending timeout', async () => { process.env.DD_LAMBDA_HANDLER = 'handler.finishSpansEarlyTimeoutHandler' await loadAgent() diff --git a/packages/dd-trace/test/opentelemetry/span.spec.js b/packages/dd-trace/test/opentelemetry/span.spec.js index 98f616076e2..2b274b35ee7 100644 --- a/packages/dd-trace/test/opentelemetry/span.spec.js +++ b/packages/dd-trace/test/opentelemetry/span.spec.js @@ -186,7 +186,7 @@ describe('OTel Span', () => { it(`should map span name when ${kindName} kind with network.protocol.name`, () => { const span = makeSpan(undefined, { - kind: kind, + kind, attributes: { 'network.protocol.name': 'protocol' } @@ -197,7 +197,7 @@ describe('OTel Span', () => { it(`should map span name when ${kindName} kind without network.protocol.name`, () => { const span = makeSpan(undefined, { - kind: kind + kind }) expect(span.name).to.equal(`${kindName}.request`) @@ -216,7 +216,7 @@ describe('OTel Span', () => { expect(span.name).to.equal(kindName) }) } - it(`should map span name with default span kind of internal`, () => { + it('should map span name with default span kind of internal', () => { const span = makeSpan() expect(span.name).to.equal('internal') }) diff --git a/packages/dd-trace/test/opentracing/propagation/text_map.spec.js b/packages/dd-trace/test/opentracing/propagation/text_map.spec.js index 8f792375879..cedf6a439a7 100644 --- a/packages/dd-trace/test/opentracing/propagation/text_map.spec.js +++ b/packages/dd-trace/test/opentracing/propagation/text_map.spec.js @@ -117,7 +117,7 @@ describe('TextMapPropagator', () => { trace: { tags: { '_dd.p.foo': 'foo', - 'bar': 'bar', + bar: 'bar', '_dd.p.baz': 'baz' } } @@ -163,7 +163,7 @@ describe('TextMapPropagator', () => { const spanContext = createContext({ trace: { tags: { - '_ddupefoo': 'value' + _ddupefoo: 'value' } } }) @@ -328,7 +328,7 @@ describe('TextMapPropagator', () => { expect(spanContext.toTraceId()).to.equal(carrier['x-datadog-trace-id']) expect(spanContext.toSpanId()).to.equal(carrier['x-datadog-parent-id']) - expect(spanContext._baggageItems['foo']).to.equal(carrier['ot-baggage-foo']) + expect(spanContext._baggageItems.foo).to.equal(carrier['ot-baggage-foo']) expect(spanContext._isRemote).to.equal(true) }) @@ -460,7 +460,7 @@ describe('TextMapPropagator', () => { const traceId = '1111aaaa2222bbbb3333cccc4444dddd' const spanId = '5555eeee6666ffff' - textMap['traceparent'] = `00-${traceId}-${spanId}-01` + textMap.traceparent = `00-${traceId}-${spanId}-01` const first = propagator.extract(textMap) @@ -469,8 +469,8 @@ describe('TextMapPropagator', () => { }) it('should always extract tracestate from tracecontext when trace IDs match', () => { - textMap['traceparent'] = '00-0000000000000000000000000000007B-0000000000000456-01' - textMap['tracestate'] = 'other=bleh,dd=t.foo_bar_baz_:abc_!@#$%^&*()_+`-~;s:2;o:foo;t.dm:-4' + textMap.traceparent = '00-0000000000000000000000000000007B-0000000000000456-01' + textMap.tracestate = 'other=bleh,dd=t.foo_bar_baz_:abc_!@#$%^&*()_+`-~;s:2;o:foo;t.dm:-4' config.tracePropagationStyle.extract = ['datadog', 'tracecontext'] const carrier = textMap @@ -480,8 +480,8 @@ describe('TextMapPropagator', () => { }) it('should extract the last datadog parent id from tracestate when p dd member is availible', () => { - textMap['traceparent'] = '00-0000000000000000000000000000007B-0000000000000456-01' - textMap['tracestate'] = 'other=bleh,dd=s:2;o:foo;p:2244eeee6666aaaa' + textMap.traceparent = '00-0000000000000000000000000000007B-0000000000000456-01' + textMap.tracestate = 'other=bleh,dd=s:2;o:foo;p:2244eeee6666aaaa' config.tracePropagationStyle.extract = ['tracecontext'] const carrier = textMap @@ -491,8 +491,8 @@ describe('TextMapPropagator', () => { }) it('should set the last datadog parent id to zero when p: is NOT in the tracestate', () => { - textMap['traceparent'] = '00-0000000000000000000000000000007B-0000000000000456-01' - textMap['tracestate'] = 'other=gg,dd=s:-1;' + textMap.traceparent = '00-0000000000000000000000000000007B-0000000000000456-01' + textMap.tracestate = 'other=gg,dd=s:-1;' config.tracePropagationStyle.extract = ['tracecontext'] const carrier = textMap @@ -500,9 +500,9 @@ describe('TextMapPropagator', () => { expect(spanContext._trace.tags).to.have.property('_dd.parent_id', '0000000000000000') }) - it(`should not extract tracestate from tracecontext when trace IDs don't match`, () => { - textMap['traceparent'] = '00-00000000000000000000000000000789-0000000000000456-01' - textMap['tracestate'] = 'other=bleh,dd=t.foo_bar_baz_:abc_!@#$%^&*()_+`-~;s:2;o:foo;t.dm:-4' + it('should not extract tracestate from tracecontext when trace IDs don\'t match', () => { + textMap.traceparent = '00-00000000000000000000000000000789-0000000000000456-01' + textMap.tracestate = 'other=bleh,dd=t.foo_bar_baz_:abc_!@#$%^&*()_+`-~;s:2;o:foo;t.dm:-4' config.tracePropagationStyle.extract = ['datadog', 'tracecontext'] const carrier = textMap @@ -511,9 +511,9 @@ describe('TextMapPropagator', () => { expect(spanContext._tracestate).to.be.undefined }) - it(`should not extract tracestate from tracecontext when configured to extract first`, () => { - textMap['traceparent'] = '00-0000000000000000000000000000007B-0000000000000456-01' - textMap['tracestate'] = 'other=bleh,dd=t.foo_bar_baz_:abc_!@#$%^&*()_+`-~;s:2;o:foo;t.dm:-4' + it('should not extract tracestate from tracecontext when configured to extract first', () => { + textMap.traceparent = '00-0000000000000000000000000000007B-0000000000000456-01' + textMap.tracestate = 'other=bleh,dd=t.foo_bar_baz_:abc_!@#$%^&*()_+`-~;s:2;o:foo;t.dm:-4' config.tracePropagationStyle.extract = ['datadog', 'tracecontext'] config.tracePropagationExtractFirst = true @@ -609,7 +609,7 @@ describe('TextMapPropagator', () => { }) it('should extract the header', () => { - textMap['b3'] = '0000000000000123-0000000000000456' + textMap.b3 = '0000000000000123-0000000000000456' const carrier = textMap const spanContext = propagator.extract(carrier) @@ -621,7 +621,7 @@ describe('TextMapPropagator', () => { }) it('should extract sampling', () => { - textMap['b3'] = '0000000000000123-0000000000000456-1' + textMap.b3 = '0000000000000123-0000000000000456-1' const carrier = textMap const spanContext = propagator.extract(carrier) @@ -636,7 +636,7 @@ describe('TextMapPropagator', () => { }) it('should support the full syntax', () => { - textMap['b3'] = '0000000000000123-0000000000000456-1-0000000000000789' + textMap.b3 = '0000000000000123-0000000000000456-1-0000000000000789' const carrier = textMap const spanContext = propagator.extract(carrier) @@ -651,7 +651,7 @@ describe('TextMapPropagator', () => { }) it('should support unsampled traces', () => { - textMap['b3'] = '0' + textMap.b3 = '0' const carrier = textMap const spanContext = propagator.extract(carrier) @@ -664,7 +664,7 @@ describe('TextMapPropagator', () => { }) it('should support sampled traces', () => { - textMap['b3'] = '1' + textMap.b3 = '1' const carrier = textMap const spanContext = propagator.extract(carrier) @@ -677,7 +677,7 @@ describe('TextMapPropagator', () => { }) it('should support the debug flag', () => { - textMap['b3'] = 'd' + textMap.b3 = 'd' const carrier = textMap const spanContext = propagator.extract(carrier) @@ -690,7 +690,7 @@ describe('TextMapPropagator', () => { }) it('should skip extraction without the feature flag', () => { - textMap['b3'] = '0000000000000123-0000000000000456-1-0000000000000789' + textMap.b3 = '0000000000000123-0000000000000456-1-0000000000000789' config.tracePropagationStyle.extract = [] @@ -701,7 +701,7 @@ describe('TextMapPropagator', () => { }) it('should support 128-bit trace IDs', () => { - textMap['b3'] = '00000000000002340000000000000123-0000000000000456' + textMap.b3 = '00000000000002340000000000000123-0000000000000456' config.traceId128BitGenerationEnabled = true @@ -720,7 +720,7 @@ describe('TextMapPropagator', () => { }) it('should skip extracting upper bits for 64-bit trace IDs', () => { - textMap['b3'] = '00000000000000000000000000000123-0000000000000456' + textMap.b3 = '00000000000000000000000000000123-0000000000000456' config.traceId128BitGenerationEnabled = true @@ -741,7 +741,7 @@ describe('TextMapPropagator', () => { }) it('should skip extraction without the feature flag', () => { - textMap['traceparent'] = '00-000000000000000000000000000004d2-000000000000162e-01' + textMap.traceparent = '00-000000000000000000000000000004d2-000000000000162e-01' config.tracePropagationStyle.extract = [] const carrier = textMap @@ -750,8 +750,8 @@ describe('TextMapPropagator', () => { }) it('should extract the header', () => { - textMap['traceparent'] = '00-1111aaaa2222bbbb3333cccc4444dddd-5555eeee6666ffff-01' - textMap['tracestate'] = 'other=bleh,dd=t.foo_bar_baz_:abc_!@#$%^&*()_+`-~;s:2;o:foo;t.dm:-4' + textMap.traceparent = '00-1111aaaa2222bbbb3333cccc4444dddd-5555eeee6666ffff-01' + textMap.tracestate = 'other=bleh,dd=t.foo_bar_baz_:abc_!@#$%^&*()_+`-~;s:2;o:foo;t.dm:-4' config.tracePropagationStyle.extract = ['tracecontext'] const carrier = textMap @@ -768,7 +768,7 @@ describe('TextMapPropagator', () => { }) it('should extract a 128-bit trace ID', () => { - textMap['traceparent'] = '00-1111aaaa2222bbbb3333cccc4444dddd-5555eeee6666ffff-01' + textMap.traceparent = '00-1111aaaa2222bbbb3333cccc4444dddd-5555eeee6666ffff-01' config.tracePropagationStyle.extract = ['tracecontext'] config.traceId128BitGenerationEnabled = true @@ -779,7 +779,7 @@ describe('TextMapPropagator', () => { }) it('should skip extracting upper bits for 64-bit trace IDs', () => { - textMap['traceparent'] = '00-00000000000000003333cccc4444dddd-5555eeee6666ffff-01' + textMap.traceparent = '00-00000000000000003333cccc4444dddd-5555eeee6666ffff-01' config.tracePropagationStyle.extract = ['tracecontext'] config.traceId128BitGenerationEnabled = true @@ -791,8 +791,8 @@ describe('TextMapPropagator', () => { }) it('should propagate the version', () => { - textMap['traceparent'] = '01-1111aaaa2222bbbb3333cccc4444dddd-5555eeee6666ffff-01' - textMap['tracestate'] = 'other=bleh,dd=t.foo_bar_baz_:abc_!@#$%^&*()_+`-~;s:2;o:foo;t.dm:-4' + textMap.traceparent = '01-1111aaaa2222bbbb3333cccc4444dddd-5555eeee6666ffff-01' + textMap.tracestate = 'other=bleh,dd=t.foo_bar_baz_:abc_!@#$%^&*()_+`-~;s:2;o:foo;t.dm:-4' config.tracePropagationStyle.extract = ['tracecontext'] const carrier = {} @@ -806,8 +806,8 @@ describe('TextMapPropagator', () => { }) it('should propagate other vendors', () => { - textMap['traceparent'] = '01-1111aaaa2222bbbb3333cccc4444dddd-5555eeee6666ffff-01' - textMap['tracestate'] = 'other=bleh,dd=t.foo_bar_baz_:abc_!@#$%^&*()_+`-~;s:2;o:foo;t.dm:-4' + textMap.traceparent = '01-1111aaaa2222bbbb3333cccc4444dddd-5555eeee6666ffff-01' + textMap.tracestate = 'other=bleh,dd=t.foo_bar_baz_:abc_!@#$%^&*()_+`-~;s:2;o:foo;t.dm:-4' config.tracePropagationStyle.extract = ['tracecontext'] const carrier = {} @@ -815,12 +815,12 @@ describe('TextMapPropagator', () => { propagator.inject(spanContext, carrier) - expect(carrier['tracestate']).to.include('other=bleh') + expect(carrier.tracestate).to.include('other=bleh') }) it('should propagate last datadog id', () => { - textMap['traceparent'] = '01-1111aaaa2222bbbb3333cccc4444dddd-5555eeee6666ffff-01' - textMap['tracestate'] = 'other=bleh,dd=s:2;o:foo;t.dm:-4;p:4444eeee6666aaaa' + textMap.traceparent = '01-1111aaaa2222bbbb3333cccc4444dddd-5555eeee6666ffff-01' + textMap.tracestate = 'other=bleh,dd=s:2;o:foo;t.dm:-4;p:4444eeee6666aaaa' config.tracePropagationStyle.extract = ['tracecontext'] const carrier = {} @@ -830,12 +830,12 @@ describe('TextMapPropagator', () => { propagator.inject(spanContext, carrier) - expect(carrier['tracestate']).to.include('p:4444eeee6666aaaa') + expect(carrier.tracestate).to.include('p:4444eeee6666aaaa') }) it('should fix _dd.p.dm if invalid (non-hyphenated) input is received', () => { - textMap['traceparent'] = '01-1111aaaa2222bbbb3333cccc4444dddd-5555eeee6666ffff-01' - textMap['tracestate'] = 'other=bleh,dd=t.foo_bar_baz_:abc_!@#$%^&*()_+`-~;s:2;o:foo;t.dm:4' + textMap.traceparent = '01-1111aaaa2222bbbb3333cccc4444dddd-5555eeee6666ffff-01' + textMap.tracestate = 'other=bleh,dd=t.foo_bar_baz_:abc_!@#$%^&*()_+`-~;s:2;o:foo;t.dm:4' config.tracePropagationStyle.extract = ['tracecontext'] const carrier = {} @@ -848,8 +848,8 @@ describe('TextMapPropagator', () => { }) it('should maintain hyphen prefix when a default mechanism of 0 is received', () => { - textMap['traceparent'] = '01-1111aaaa2222bbbb3333cccc4444dddd-5555eeee6666ffff-01' - textMap['tracestate'] = 'other=bleh,dd=t.foo_bar_baz_:abc_!@#$%^&*()_+`-~;s:2;o:foo;t.dm:-0' + textMap.traceparent = '01-1111aaaa2222bbbb3333cccc4444dddd-5555eeee6666ffff-01' + textMap.tracestate = 'other=bleh,dd=t.foo_bar_baz_:abc_!@#$%^&*()_+`-~;s:2;o:foo;t.dm:-0' config.tracePropagationStyle.extract = ['tracecontext'] const carrier = {} diff --git a/packages/dd-trace/test/opentracing/span.spec.js b/packages/dd-trace/test/opentracing/span.spec.js index bc8d6a6a59d..754d0a67f37 100644 --- a/packages/dd-trace/test/opentracing/span.spec.js +++ b/packages/dd-trace/test/opentracing/span.spec.js @@ -46,7 +46,7 @@ describe('Span', () => { } Span = proxyquire('../src/opentracing/span', { - 'perf_hooks': { + perf_hooks: { performance: { now } @@ -204,7 +204,7 @@ describe('Span', () => { traceId: '123', spanId: '456', _baggageItems: { - 'foo': 'bar' + foo: 'bar' }, _trace: { started: ['span'], diff --git a/packages/dd-trace/test/opentracing/tracer.spec.js b/packages/dd-trace/test/opentracing/tracer.spec.js index 4efb96fc753..2b6927e99d4 100644 --- a/packages/dd-trace/test/opentracing/tracer.spec.js +++ b/packages/dd-trace/test/opentracing/tracer.spec.js @@ -125,7 +125,7 @@ describe('Tracer', () => { }, true) expect(span.addTags).to.have.been.calledWith({ - 'foo': 'bar' + foo: 'bar' }) expect(testSpan).to.equal(span) @@ -221,13 +221,13 @@ describe('Tracer', () => { it('should merge default tracer tags with span tags', () => { config.tags = { - 'foo': 'tracer', - 'bar': 'tracer' + foo: 'tracer', + bar: 'tracer' } fields.tags = { - 'bar': 'span', - 'baz': 'span' + bar: 'span', + baz: 'span' } tracer = new Tracer(config) diff --git a/packages/dd-trace/test/pkg.spec.js b/packages/dd-trace/test/pkg.spec.js index 7eb65f0fe73..0248da089de 100644 --- a/packages/dd-trace/test/pkg.spec.js +++ b/packages/dd-trace/test/pkg.spec.js @@ -12,7 +12,7 @@ describe('pkg', () => { if (os.platform() !== 'win32') { describe('in pre-require', () => { it('should load the package.json correctly', () => { - const pkg = JSON.parse(execSync(`node --require ./pkg-loader.js -e ""`, { + const pkg = JSON.parse(execSync('node --require ./pkg-loader.js -e ""', { cwd: __dirname }).toString()) expect(pkg.name).to.equal('dd-trace') @@ -39,6 +39,6 @@ describe('load', () => { pathStub.parse = function () { return undefined } - proxyquire('../src/pkg', { 'path': pathStub }) + proxyquire('../src/pkg', { path: pathStub }) }) }) diff --git a/packages/dd-trace/test/plugin_manager.spec.js b/packages/dd-trace/test/plugin_manager.spec.js index 9bd377fdc07..d7613955f44 100644 --- a/packages/dd-trace/test/plugin_manager.spec.js +++ b/packages/dd-trace/test/plugin_manager.spec.js @@ -245,7 +245,7 @@ describe('Plugin Manager', () => { }) describe('service naming schema manager', () => { const config = { - foo: { 'bar': 1 }, + foo: { bar: 1 }, baz: 2 } let configureSpy diff --git a/packages/dd-trace/test/plugins/agent.js b/packages/dd-trace/test/plugins/agent.js index b47a6e828b1..8b64a7b74da 100644 --- a/packages/dd-trace/test/plugins/agent.js +++ b/packages/dd-trace/test/plugins/agent.js @@ -93,7 +93,7 @@ function handleTraceRequest (req, res, sendToTestAgent) { const testAgentUrl = process.env.DD_TEST_AGENT_URL || 'http://127.0.0.1:9126' // remove incorrect headers - delete req.headers['host'] + delete req.headers.host delete req.headers['content-type'] delete req.headers['content-length'] diff --git a/packages/dd-trace/test/plugins/outbound.spec.js b/packages/dd-trace/test/plugins/outbound.spec.js index 16ed6300c09..af5fbfe0b4d 100644 --- a/packages/dd-trace/test/plugins/outbound.spec.js +++ b/packages/dd-trace/test/plugins/outbound.spec.js @@ -88,7 +88,7 @@ describe('OuboundPlugin', () => { it('should use specific tags in order of precedence if they are available', () => { class WithPrecursors extends OutboundPlugin { - static get peerServicePrecursors () { return [ 'foo', 'bar' ] } + static get peerServicePrecursors () { return ['foo', 'bar'] } } const res = new WithPrecursors().getPeerService({ fooIsNotAPrecursor: 'bar', @@ -119,8 +119,8 @@ describe('OuboundPlugin', () => { it('should return peer data unchanged if there is no peer service', () => { mappingStub = sinon.stub(instance, '_tracerConfig').value({}) - const mappingData = instance.getPeerServiceRemap({ 'foo': 'bar' }) - expect(mappingData).to.deep.equal({ 'foo': 'bar' }) + const mappingData = instance.getPeerServiceRemap({ foo: 'bar' }) + expect(mappingData).to.deep.equal({ foo: 'bar' }) }) it('should return peer data unchanged if no mapping is available', () => { diff --git a/packages/dd-trace/test/plugins/suite.js b/packages/dd-trace/test/plugins/suite.js index 65d6e6ccb78..a0cb20845b4 100644 --- a/packages/dd-trace/test/plugins/suite.js +++ b/packages/dd-trace/test/plugins/suite.js @@ -35,6 +35,7 @@ async function getLatest (modName, repoUrl) { function get (theUrl) { return new Promise((resolve, reject) => { + // eslint-disable-next-line n/no-deprecated-api const options = url.parse(theUrl) options.headers = { 'user-agent': 'dd-trace plugin test suites' @@ -131,7 +132,7 @@ async function setup (modName, repoName, commitish) { const repoUrl = `https://github.com/${repoName}.git` const cwd = await getTmpDir() await execOrError(`git clone ${repoUrl} --branch ${commitish} --single-branch ${cwd}`) - await execOrError(`npm install --legacy-peer-deps`, { cwd }) + await execOrError('npm install --legacy-peer-deps', { cwd }) } async function cleanup () { @@ -195,7 +196,7 @@ ${withTracer.stderr} function getOpts (args) { args = Array.from(args) - const [ modName, repoUrl, commitish, runner, timeout, testCmd ] = args + const [modName, repoUrl, commitish, runner, timeout, testCmd] = args const options = { modName, repoUrl, diff --git a/packages/dd-trace/test/plugins/tracing.spec.js b/packages/dd-trace/test/plugins/tracing.spec.js index b8331f7915e..43548c4774a 100644 --- a/packages/dd-trace/test/plugins/tracing.spec.js +++ b/packages/dd-trace/test/plugins/tracing.spec.js @@ -54,7 +54,7 @@ describe('common Plugin behaviour', () => { } } - const testPlugins = { 'commonPlugin': CommonPlugin, 'suffixPlugin': SuffixPlugin } + const testPlugins = { commonPlugin: CommonPlugin, suffixPlugin: SuffixPlugin } const loadChannel = channel('dd-trace:instrumentation:load') before(() => { diff --git a/packages/dd-trace/test/plugins/util/git.spec.js b/packages/dd-trace/test/plugins/util/git.spec.js index 7f275287678..c0daca3f7bc 100644 --- a/packages/dd-trace/test/plugins/util/git.spec.js +++ b/packages/dd-trace/test/plugins/util/git.spec.js @@ -28,7 +28,7 @@ const { const { getGitMetadata, unshallowRepository } = proxyquire('../../../src/plugins/util/git', { - 'child_process': { + child_process: { execFileSync: execFileSyncStub } } @@ -144,8 +144,8 @@ describe('getCommitsRevList', () => { const { getCommitsRevList } = proxyquire('../../../src/plugins/util/git', { - 'child_process': { - 'execFileSync': (command, flags, options) => + child_process: { + execFileSync: (command, flags, options) => execSync(`head -c ${Math.floor(GIT_REV_LIST_MAX_BUFFER * 0.9)} /dev/zero`, options) }, '../../log': { @@ -162,8 +162,8 @@ describe('getCommitsRevList', () => { const { getCommitsRevList } = proxyquire('../../../src/plugins/util/git', { - 'child_process': { - 'execFileSync': (command, flags, options) => + child_process: { + execFileSync: (command, flags, options) => execSync(`head -c ${GIT_REV_LIST_MAX_BUFFER * 2} /dev/zero`, options) }, '../../log': { @@ -194,8 +194,8 @@ describe('generatePackFilesForCommits', () => { const { generatePackFilesForCommits } = proxyquire('../../../src/plugins/util/git', { - 'child_process': { - 'execFileSync': execFileSyncSpy + child_process: { + execFileSync: execFileSyncSpy } } ) @@ -212,8 +212,8 @@ describe('generatePackFilesForCommits', () => { const { generatePackFilesForCommits } = proxyquire('../../../src/plugins/util/git', { - 'child_process': { - 'execFileSync': execFileSyncSpy + child_process: { + execFileSync: execFileSyncSpy } } ) @@ -230,8 +230,8 @@ describe('generatePackFilesForCommits', () => { const { generatePackFilesForCommits } = proxyquire('../../../src/plugins/util/git', { - 'child_process': { - 'execFileSync': execFileSyncSpy + child_process: { + execFileSync: execFileSyncSpy } } ) diff --git a/packages/dd-trace/test/plugins/util/test-environment.spec.js b/packages/dd-trace/test/plugins/util/test-environment.spec.js index 547e2521b58..7599da38c4a 100644 --- a/packages/dd-trace/test/plugins/util/test-environment.spec.js +++ b/packages/dd-trace/test/plugins/util/test-environment.spec.js @@ -12,13 +12,13 @@ const { getCIMetadata } = require('../../../src/plugins/util/ci') const { CI_ENV_VARS, CI_NODE_LABELS } = require('../../../src/plugins/util/tags') const { getGitMetadata } = proxyquire('../../../src/plugins/util/git', { - 'child_process': { - 'execFileSync': execFileSyncStub + child_process: { + execFileSync: execFileSyncStub } }) const { getTestEnvironmentMetadata } = proxyquire('../../../src/plugins/util/test', { './git': { - 'getGitMetadata': getGitMetadata + getGitMetadata } }) diff --git a/packages/dd-trace/test/plugins/util/test.spec.js b/packages/dd-trace/test/plugins/util/test.spec.js index 9ba79403013..02301c0eb97 100644 --- a/packages/dd-trace/test/plugins/util/test.spec.js +++ b/packages/dd-trace/test/plugins/util/test.spec.js @@ -21,28 +21,28 @@ const { GIT_REPOSITORY_URL, GIT_COMMIT_SHA, CI_PIPELINE_URL } = require('../../. describe('getTestParametersString', () => { it('returns formatted test parameters and removes params from input', () => { - const input = { 'test_stuff': [['params'], [{ b: 'c' }]] } + const input = { test_stuff: [['params'], [{ b: 'c' }]] } expect(getTestParametersString(input, 'test_stuff')).to.equal( JSON.stringify({ arguments: ['params'], metadata: {} }) ) - expect(input).to.eql({ 'test_stuff': [[{ b: 'c' }]] }) + expect(input).to.eql({ test_stuff: [[{ b: 'c' }]] }) expect(getTestParametersString(input, 'test_stuff')).to.equal( JSON.stringify({ arguments: [{ b: 'c' }], metadata: {} }) ) - expect(input).to.eql({ 'test_stuff': [] }) + expect(input).to.eql({ test_stuff: [] }) }) it('does not crash when test name is not found and does not modify input', () => { - const input = { 'test_stuff': [['params'], ['params2']] } + const input = { test_stuff: [['params'], ['params2']] } expect(getTestParametersString(input, 'test_not_present')).to.equal('') - expect(input).to.eql({ 'test_stuff': [['params'], ['params2']] }) + expect(input).to.eql({ test_stuff: [['params'], ['params2']] }) }) it('does not crash when parameters can not be serialized and removes params from input', () => { const circular = { a: 'b' } circular.b = circular - const input = { 'test_stuff': [[circular], ['params2']] } + const input = { test_stuff: [[circular], ['params2']] } expect(getTestParametersString(input, 'test_stuff')).to.equal('') - expect(input).to.eql({ 'test_stuff': [['params2']] }) + expect(input).to.eql({ test_stuff: [['params2']] }) expect(getTestParametersString(input, 'test_stuff')).to.equal( JSON.stringify({ arguments: ['params2'], metadata: {} }) ) diff --git a/packages/dd-trace/test/plugins/util/web.spec.js b/packages/dd-trace/test/plugins/util/web.spec.js index f3d61a743be..821d2d8d537 100644 --- a/packages/dd-trace/test/plugins/util/web.spec.js +++ b/packages/dd-trace/test/plugins/util/web.spec.js @@ -41,8 +41,8 @@ describe('plugins/util/web', () => { req = { method: 'GET', headers: { - 'host': 'localhost', - 'date': 'now' + host: 'localhost', + date: 'now' } } end = sinon.stub() @@ -250,8 +250,8 @@ describe('plugins/util/web', () => { }) it('should add configured headers to the span tags', () => { - req.headers['req'] = 'incoming' - req.headers['res'] = 'outgoing' + req.headers.req = 'incoming' + req.headers.res = 'outgoing' config.headers = ['host', 'req:http.req', 'server', 'res:http.res'] config = web.normalizeConfig(config) @@ -353,7 +353,7 @@ describe('plugins/util/web', () => { ].join(',') req.method = 'OPTIONS' - req.headers['origin'] = 'http://test.com' + req.headers.origin = 'http://test.com' req.headers['access-control-request-headers'] = headers res.getHeaders.returns({ @@ -374,7 +374,7 @@ describe('plugins/util/web', () => { ].join(',') req.method = 'OPTIONS' - req.headers['origin'] = 'http://test.com' + req.headers.origin = 'http://test.com' req.headers['access-control-request-headers'] = headers res.getHeaders.returns({ @@ -392,7 +392,7 @@ describe('plugins/util/web', () => { const headers = ['x-datadog-trace-id'] req.method = 'OPTIONS' - req.headers['origin'] = 'http://test.com' + req.headers.origin = 'http://test.com' req.headers['access-control-request-headers'] = headers web.instrument(tracer, config, req, res, 'test.request') @@ -404,7 +404,7 @@ describe('plugins/util/web', () => { it('should handle CORS preflight when no header was requested', () => { req.method = 'OPTIONS' - req.headers['origin'] = 'http://test.com' + req.headers.origin = 'http://test.com' res.getHeaders.returns({ 'access-control-allow-origin': 'http://test.com' @@ -902,7 +902,7 @@ describe('plugins/util/web', () => { beforeEach(() => { config = { - queryStringObfuscation: new RegExp('secret', 'gi') + queryStringObfuscation: /secret/gi } }) diff --git a/packages/dd-trace/test/profiling/exporters/agent.spec.js b/packages/dd-trace/test/profiling/exporters/agent.spec.js index 88f3fa54886..651a04a89b9 100644 --- a/packages/dd-trace/test/profiling/exporters/agent.spec.js +++ b/packages/dd-trace/test/profiling/exporters/agent.spec.js @@ -37,7 +37,7 @@ function wait (ms) { } async function createProfile (periodType) { - const [ type ] = periodType + const [type] = periodType const profiler = type === 'wall' ? new WallProfiler() : new SpaceProfiler() profiler.start({ // Throw errors in test rather than logging them @@ -45,6 +45,7 @@ async function createProfile (periodType) { error (err) { throw err }, + // eslint-disable-next-line n/handle-callback-err warn (err) { } } @@ -152,7 +153,7 @@ describe('exporters/agent', function () { } const agent = proxyquire('../../../src/profiling/exporters/agent', { '../../exporters/common/docker': docker, - 'http': http + http }) AgentExporter = agent.AgentExporter computeRetries = agent.computeRetries @@ -197,7 +198,7 @@ describe('exporters/agent', function () { 'runtime-id': RUNTIME_ID } - const [ wall, space ] = await Promise.all([ + const [wall, space] = await Promise.all([ createProfile(['wall', 'microseconds']), createProfile(['space', 'bytes']) ]) @@ -240,7 +241,7 @@ describe('exporters/agent', function () { 'runtime-id': RUNTIME_ID } - const [ wall, space ] = await Promise.all([ + const [wall, space] = await Promise.all([ createProfile(['wall', 'microseconds']), createProfile(['space', 'bytes']) ]) @@ -323,7 +324,7 @@ describe('exporters/agent', function () { const end = new Date() const tags = { foo: 'bar' } - const [ wall, space ] = await Promise.all([ + const [wall, space] = await Promise.all([ createProfile(['wall', 'microseconds']), createProfile(['space', 'bytes']) ]) @@ -378,7 +379,7 @@ describe('exporters/agent', function () { 'runtime-id': RUNTIME_ID } - const [ wall, space ] = await Promise.all([ + const [wall, space] = await Promise.all([ createProfile(['wall', 'microseconds']), createProfile(['space', 'bytes']) ]) diff --git a/packages/dd-trace/test/profiling/tagger.spec.js b/packages/dd-trace/test/profiling/tagger.spec.js index 2aaec15abf2..db01befd9d6 100644 --- a/packages/dd-trace/test/profiling/tagger.spec.js +++ b/packages/dd-trace/test/profiling/tagger.spec.js @@ -27,7 +27,7 @@ describe('tagger', () => { const tags = { foo: 'bar', baz: 'qux', - undefined: undefined, + undefined, null: null } diff --git a/packages/dd-trace/test/proxy.spec.js b/packages/dd-trace/test/proxy.spec.js index b9f58ed49e3..24daade1158 100644 --- a/packages/dd-trace/test/proxy.spec.js +++ b/packages/dd-trace/test/proxy.spec.js @@ -80,9 +80,11 @@ describe('TracerProxy', () => { constructor (cfg) { dogstatsdConfig = cfg } + increment () { dogstatsdIncrements.push(arguments) } + flush () { dogstatsdFlushes++ } diff --git a/packages/dd-trace/test/sampling_rule.spec.js b/packages/dd-trace/test/sampling_rule.spec.js index 27b2a152c90..49ce1153d2e 100644 --- a/packages/dd-trace/test/sampling_rule.spec.js +++ b/packages/dd-trace/test/sampling_rule.spec.js @@ -60,9 +60,9 @@ function createDummySpans () { } if (idx === 9) { - spanContext._tags['tagged'] = 'yup' - spanContext._tags['and'] = 'this' - spanContext._tags['not'] = 'this' + spanContext._tags.tagged = 'yup' + spanContext._tags.and = 'this' + spanContext._tags.not = 'this' } if (idx === 10) { diff --git a/packages/dd-trace/test/serverless.spec.js b/packages/dd-trace/test/serverless.spec.js index cf4a75c4ac3..8ba4eb33273 100644 --- a/packages/dd-trace/test/serverless.spec.js +++ b/packages/dd-trace/test/serverless.spec.js @@ -117,8 +117,8 @@ describe('Serverless', () => { }) expect(path).to.be.equal( - `/home/site/wwwroot/node_modules/@datadog/sma/\ -datadog-serverless-agent-linux-amd64/datadog-serverless-trace-mini-agent` + '/home/site/wwwroot/node_modules/@datadog/sma/' + + 'datadog-serverless-agent-linux-amd64/datadog-serverless-trace-mini-agent' ) }) @@ -130,8 +130,8 @@ datadog-serverless-agent-linux-amd64/datadog-serverless-trace-mini-agent` }) expect(path).to.be.equal( - `/home/site/wwwroot/node_modules/@datadog/sma/\ -datadog-serverless-agent-windows-amd64/datadog-serverless-trace-mini-agent.exe` + '/home/site/wwwroot/node_modules/@datadog/sma/' + + 'datadog-serverless-agent-windows-amd64/datadog-serverless-trace-mini-agent.exe' ) }) }) diff --git a/packages/dd-trace/test/setup/mocha.js b/packages/dd-trace/test/setup/mocha.js index 2be25250dda..5a770ec8a1a 100644 --- a/packages/dd-trace/test/setup/mocha.js +++ b/packages/dd-trace/test/setup/mocha.js @@ -81,7 +81,7 @@ function withNamingSchema ( const { opName, serviceName } = expected[versionName] - it(`should conform to the naming schema`, () => { + it('should conform to the naming schema', () => { return new Promise((resolve, reject) => { agent .use(traces => { @@ -120,7 +120,7 @@ function withNamingSchema ( hooks('v0', true) - const { serviceName } = expected['v1'] + const { serviceName } = expected.v1 it('should pass service name through', done => { agent @@ -191,7 +191,8 @@ function withVersions (plugin, modules, range, cb) { instrumentations .filter(instrumentation => instrumentation.name === moduleName) .forEach(instrumentation => { - const versions = process.env.PACKAGE_VERSION_RANGE ? [process.env.PACKAGE_VERSION_RANGE] + const versions = process.env.PACKAGE_VERSION_RANGE + ? [process.env.PACKAGE_VERSION_RANGE] : instrumentation.versions versions .filter(version => !process.env.RANGE || semver.subset(version, process.env.RANGE)) @@ -209,7 +210,10 @@ function withVersions (plugin, modules, range, cb) { .sort(v => v[0].localeCompare(v[0])) .map(v => Object.assign({}, v[1], { version: v[0] })) .forEach(v => { - const versionPath = `${__dirname}/../../../../versions/${moduleName}@${v.test}/node_modules` + const versionPath = path.resolve( + __dirname, '../../../../versions/', + `${moduleName}@${v.test}/node_modules` + ) describe(`with ${moduleName} ${v.range} (${v.version})`, () => { let nodePath diff --git a/packages/dd-trace/test/setup/services/couchbase.js b/packages/dd-trace/test/setup/services/couchbase.js index 94bddbf7920..022f576be12 100644 --- a/packages/dd-trace/test/setup/services/couchbase.js +++ b/packages/dd-trace/test/setup/services/couchbase.js @@ -12,7 +12,7 @@ function waitForCouchbase () { axios({ method: 'POST', url: cbasEndpoint, - data: { 'statement': 'SELECT * FROM datatest', 'timeout': '75000000us' }, + data: { statement: 'SELECT * FROM datatest', timeout: '75000000us' }, auth: { username: 'Administrator', password: 'password' diff --git a/packages/dd-trace/test/telemetry/dependencies.spec.js b/packages/dd-trace/test/telemetry/dependencies.spec.js index f09f1be2774..385415137d8 100644 --- a/packages/dd-trace/test/telemetry/dependencies.spec.js +++ b/packages/dd-trace/test/telemetry/dependencies.spec.js @@ -382,7 +382,7 @@ describe('dependencies', () => { capturedRequestType = reqType // Simulate an HTTP error by calling the callback with an error cb(new Error('HTTP request error'), { - payload: payload, + payload, reqType: 'app-integrations-change' }) } @@ -430,7 +430,7 @@ describe('dependencies', () => { getRetryData.returns({ request_type: 'app-integrations-change', payload: { - 'integrations': [{ + integrations: [{ name: 'zoo1', enabled: true, auto_enabled: true diff --git a/packages/dd-trace/test/telemetry/index.spec.js b/packages/dd-trace/test/telemetry/index.spec.js index d6bc3d60d75..fd67ac3e3fc 100644 --- a/packages/dd-trace/test/telemetry/index.spec.js +++ b/packages/dd-trace/test/telemetry/index.spec.js @@ -72,8 +72,8 @@ describe('telemetry', () => { appsec: { enabled: true }, profiling: { enabled: true }, peerServiceMapping: { - 'service_1': 'remapped_service_1', - 'service_2': 'remapped_service_2' + service_1: 'remapped_service_1', + service_2: 'remapped_service_2' }, installSignature: { id: '68e75c48-57ca-4a12-adfc-575c4b05fcbe', @@ -426,7 +426,7 @@ describe('Telemetry retry', () => { } // Simulate an HTTP error by calling the callback with an error cb(new Error('HTTP request error'), { - payload: payload, + payload, reqType: 'app-integrations-change' }) } @@ -461,7 +461,7 @@ describe('Telemetry retry', () => { telemetry.updateIntegrations() expect(capturedRequestType).to.equal('app-integrations-change') expect(capturedPayload).to.deep.equal({ - 'integrations': [{ + integrations: [{ name: 'boo3', enabled: true, auto_enabled: true @@ -474,7 +474,7 @@ describe('Telemetry retry', () => { expect(capturedPayload).to.deep.equal([{ request_type: 'app-integrations-change', payload: { - 'integrations': [{ + integrations: [{ name: 'boo5', enabled: true, auto_enabled: true @@ -484,7 +484,7 @@ describe('Telemetry retry', () => { }, { request_type: 'app-integrations-change', payload: { - 'integrations': [{ + integrations: [{ name: 'boo3', enabled: true, auto_enabled: true @@ -512,8 +512,8 @@ describe('Telemetry retry', () => { } // Simulate an HTTP error by calling the callback with an error cb(new Error('HTTP request error'), { - payload: payload, - reqType: reqType + payload, + reqType }) } @@ -551,7 +551,7 @@ describe('Telemetry retry', () => { }, { request_type: 'app-integrations-change', payload: { - 'integrations': [{ + integrations: [{ name: 'foo2', enabled: true, auto_enabled: true @@ -581,7 +581,7 @@ describe('Telemetry retry', () => { // Simulate an HTTP error by calling the callback with an error cb(new Error('HTTP request error'), { - payload: payload, + payload, reqType: 'app-integrations-change' }) } @@ -619,7 +619,7 @@ describe('Telemetry retry', () => { expect(capturedRequestType).to.equal('app-integrations-change') expect(capturedPayload).to.deep.equal({ - 'integrations': [{ + integrations: [{ name: 'zoo1', enabled: true, auto_enabled: true @@ -641,8 +641,8 @@ describe('Telemetry retry', () => { // Simulate an HTTP error by calling the callback with an error cb(new Error('HTTP request error'), { - payload: payload, - reqType: reqType + payload, + reqType }) } @@ -683,7 +683,7 @@ describe('Telemetry retry', () => { expect(capturedPayload).to.deep.equal([{ request_type: 'app-integrations-change', payload: { - 'integrations': [{ + integrations: [{ name: 'zoo1', enabled: true, auto_enabled: true @@ -693,7 +693,7 @@ describe('Telemetry retry', () => { }, { request_type: 'app-integrations-change', payload: { - 'integrations': [{ + integrations: [{ name: 'foo1', enabled: true, auto_enabled: true @@ -723,8 +723,8 @@ describe('Telemetry retry', () => { // Simulate an HTTP error by calling the callback with an error cb(new Error('HTTP request error'), { - payload: payload, - reqType: reqType + payload, + reqType }) } @@ -761,7 +761,7 @@ describe('Telemetry retry', () => { clock.tick(86400000) expect(extendedHeartbeatRequest).to.equal('app-extended-heartbeat') expect(extendedHeartbeatPayload).to.haveOwnProperty('integrations') - expect(extendedHeartbeatPayload['integrations']).to.deep.include({ + expect(extendedHeartbeatPayload.integrations).to.deep.include({ integrations: [ { name: 'foo2', enabled: true, auto_enabled: true }, { name: 'bar2', enabled: false, auto_enabled: true } @@ -776,7 +776,7 @@ async function testSeq (seqId, reqType, validatePayload) { } const req = traceAgent.reqs[seqId - 1] expect(req.method).to.equal('POST') - expect(req.url).to.equal(`/telemetry/proxy/api/v2/apmtelemetry`) + expect(req.url).to.equal('/telemetry/proxy/api/v2/apmtelemetry') expect(req.headers).to.include({ 'content-type': 'application/json', 'dd-telemetry-api-version': 'v2', diff --git a/packages/dd-trace/test/telemetry/logs/index.spec.js b/packages/dd-trace/test/telemetry/logs/index.spec.js index 1ed06d41976..28e80cd2fc1 100644 --- a/packages/dd-trace/test/telemetry/logs/index.spec.js +++ b/packages/dd-trace/test/telemetry/logs/index.spec.js @@ -165,7 +165,7 @@ describe('telemetry logs', () => { logs.send(defaultConfig, application, host) - expect(sendData).to.be.calledOnceWithExactly(defaultConfig, application, host, 'logs', { 'logs': collectedLogs }) + expect(sendData).to.be.calledOnceWithExactly(defaultConfig, application, host, 'logs', { logs: collectedLogs }) }) it('should not drain logCollector and call sendData if not enabled', () => { diff --git a/packages/dd-trace/test/telemetry/send-data.spec.js b/packages/dd-trace/test/telemetry/send-data.spec.js index 1739c591137..5cbe3d3ab85 100644 --- a/packages/dd-trace/test/telemetry/send-data.spec.js +++ b/packages/dd-trace/test/telemetry/send-data.spec.js @@ -114,10 +114,10 @@ describe('sendData', () => { }) it('should send batch request with retryPayload', () => { - const retryObjData = { 'payload': { 'foo': 'bar' }, 'request_type': 'req-type-1' } + const retryObjData = { payload: { foo: 'bar' }, request_type: 'req-type-1' } const payload = [{ - 'request_type': 'req-type-2', - 'payload': { + request_type: 'req-type-2', + payload: { integrations: [ { name: 'foo2', enabled: true, auto_enabled: true }, { name: 'bar2', enabled: false, auto_enabled: true } @@ -127,22 +127,22 @@ describe('sendData', () => { }, retryObjData] sendDataModule.sendData({ tags: { 'runtime-id': '123' } }, - { 'language': 'js' }, 'test', 'message-batch', payload) / + { language: 'js' }, 'test', 'message-batch', payload) / expect(request).to.have.been.calledOnce const data = JSON.parse(request.getCall(0).args[0]) const expectedPayload = [{ - 'request_type': 'req-type-2', - 'payload': { + request_type: 'req-type-2', + payload: { integrations: [ { name: 'foo2', enabled: true, auto_enabled: true }, { name: 'bar2', enabled: false, auto_enabled: true } ] } }, { - 'request_type': 'req-type-1', - 'payload': { 'foo': 'bar' } + request_type: 'req-type-1', + payload: { foo: 'bar' } }] expect(data.request_type).to.equal('message-batch') expect(data.payload).to.deep.equal(expectedPayload) diff --git a/scripts/check-proposal-labels.js b/scripts/check-proposal-labels.js index 02a5f0bede3..87d89cce777 100644 --- a/scripts/check-proposal-labels.js +++ b/scripts/check-proposal-labels.js @@ -3,14 +3,14 @@ const childProcess = require('child_process') const ORIGIN = 'origin/' -let releaseBranch = process.env['GITHUB_BASE_REF'] // 'origin/v3.x' +let releaseBranch = process.env.GITHUB_BASE_REF // 'origin/v3.x' let releaseVersion = releaseBranch if (releaseBranch.startsWith(ORIGIN)) { releaseVersion = releaseBranch.substring(ORIGIN.length) } else { releaseBranch = ORIGIN + releaseBranch } -let currentBranch = process.env['GITHUB_HEAD_REF'] // 'ugaitz/workflow-to-verify-dont-land-on-v3.x' +let currentBranch = process.env.GITHUB_HEAD_REF // 'ugaitz/workflow-to-verify-dont-land-on-v3.x' if (!currentBranch.startsWith(ORIGIN)) { currentBranch = ORIGIN + currentBranch } @@ -56,11 +56,8 @@ ${withoutExclusionStderr} } const commitsHashesWithoutExclusions = withoutExclusionStdout.split('\n') if (commitsHashesWithExclusions.length !== commitsHashesWithoutExclusions.length) { - const commitsWithInvalidLabels = [] - commitsHashesWithoutExclusions.filter(c1 => { - if (!commitsHashesWithExclusions.some(c2 => c2 === c1)) { - commitsWithInvalidLabels.push(c1) - } + const commitsWithInvalidLabels = commitsHashesWithoutExclusions.filter(c1 => { + return !commitsHashesWithExclusions.some(c2 => c2 === c1) }) console.error('Some excluded label added in the release proposal', commitsWithInvalidLabels) process.exit(1) diff --git a/scripts/install_plugin_modules.js b/scripts/install_plugin_modules.js index b76365bda67..f61774f5619 100644 --- a/scripts/install_plugin_modules.js +++ b/scripts/install_plugin_modules.js @@ -80,7 +80,8 @@ async function assertVersions () { } async function assertInstrumentation (instrumentation, external) { - const versions = process.env.PACKAGE_VERSION_RANGE ? [process.env.PACKAGE_VERSION_RANGE] + const versions = process.env.PACKAGE_VERSION_RANGE + ? [process.env.PACKAGE_VERSION_RANGE] : [].concat(instrumentation.versions || []) for (const version of versions) { @@ -134,7 +135,7 @@ async function assertPackage (name, version, dependency, external) { if (!external) { if (name === 'aerospike') { pkg.installConfig = { - 'hoistingLimits': 'workspaces' + hoistingLimits: 'workspaces' } } else { pkg.workspaces = { diff --git a/scripts/publish_docs.js b/scripts/publish_docs.js index aa5664bef49..c8d7512d6b8 100644 --- a/scripts/publish_docs.js +++ b/scripts/publish_docs.js @@ -3,7 +3,7 @@ const exec = require('./helpers/exec') const title = require('./helpers/title') -title(`Publishing API documentation to GitHub Pages`) +title('Publishing API documentation to GitHub Pages') const msg = process.argv[2] diff --git a/yarn.lock b/yarn.lock index c2e564f00e8..73c79d23b45 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2038,10 +2038,10 @@ escape-string-regexp@^2.0.0: resolved "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-2.0.0.tgz" integrity sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w== -eslint-config-standard@^11.0.0-beta.0: - version "11.0.0" - resolved "https://registry.npmjs.org/eslint-config-standard/-/eslint-config-standard-11.0.0.tgz" - integrity sha512-oDdENzpViEe5fwuRCWla7AXQd++/oyIp8zP+iP9jiUPG6NBj3SHgdgtl/kTn00AjeN+1HNvavTKmYbMo+xMOlw== +eslint-config-standard@^17.1.0: + version "17.1.0" + resolved "https://registry.yarnpkg.com/eslint-config-standard/-/eslint-config-standard-17.1.0.tgz#40ffb8595d47a6b242e07cbfd49dc211ed128975" + integrity sha512-IwHwmaBNtDK4zDHQukFDW5u/aTb8+meQWZvNFWkiGmbWjD6bqyuSSBxxXKkCftCUzc1zwCH2m/baCNDLGmuO5Q== eslint-import-resolver-node@^0.3.6: version "0.3.6" @@ -2107,16 +2107,6 @@ eslint-plugin-n@^15.7.0: resolve "^1.22.1" semver "^7.3.8" -eslint-plugin-node@^5.2.1: - version "5.2.1" - resolved "https://registry.npmjs.org/eslint-plugin-node/-/eslint-plugin-node-5.2.1.tgz" - integrity sha512-xhPXrh0Vl/b7870uEbaumb2Q+LxaEcOQ3kS1jtIXanBAwpMre1l5q/l2l/hESYJGEFKuI78bp6Uw50hlpr7B+g== - dependencies: - ignore "^3.3.6" - minimatch "^3.0.4" - resolve "^1.3.3" - semver "5.3.0" - eslint-plugin-promise@^3.6.0: version "3.8.0" resolved "https://registry.npmjs.org/eslint-plugin-promise/-/eslint-plugin-promise-3.8.0.tgz" @@ -2811,11 +2801,6 @@ ieee754@^1.1.4, ieee754@^1.1.8: resolved "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz" integrity sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA== -ignore@^3.3.6: - version "3.3.10" - resolved "https://registry.npmjs.org/ignore/-/ignore-3.3.10.tgz" - integrity sha512-Pgs951kaMm5GXP7MOvxERINe3gsaVjUWFm+UZPSq9xYriQAksyhg0csnS0KXSNRD5NmNdapXEpjxG49+AKh/ug== - ignore@^5.1.1, ignore@^5.2.4: version "5.2.4" resolved "https://registry.npmjs.org/ignore/-/ignore-5.2.4.tgz" @@ -4328,7 +4313,7 @@ resolve@^1.20.0, resolve@^1.22.0: path-parse "^1.0.7" supports-preserve-symlinks-flag "^1.0.0" -resolve@^1.22.1, resolve@^1.3.3: +resolve@^1.22.1: version "1.22.2" resolved "https://registry.npmjs.org/resolve/-/resolve-1.22.2.tgz" integrity sha512-Sb+mjNHOULsBv818T40qSPeRiuWLyaGMa5ewydRLFimneixmVy2zdivRl+AF6jaYPC8ERxGDmFSiqui6SfPd+g== @@ -4447,11 +4432,6 @@ scheduler@^0.20.2: loose-envify "^1.1.0" object-assign "^4.1.1" -semver@5.3.0: - version "5.3.0" - resolved "https://registry.npmjs.org/semver/-/semver-5.3.0.tgz" - integrity sha512-mfmm3/H9+67MCVix1h+IXTpDwL6710LyHuk7+cWC9T1mE0qz4iHhh6r4hU2wrIT9iTsAAC2XQRvfblL028cpLw== - semver@^6.0.0, semver@^6.3.0, semver@^6.3.1: version "6.3.1" resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.1.tgz#556d2ef8689146e46dcea4bfdd095f3434dffcb4"