Skip to content

chore: add no-unused-expressions lint rule#7007

Merged
BridgeAR merged 15 commits intomasterfrom
simon-id-patch-2
Feb 4, 2026
Merged

chore: add no-unused-expressions lint rule#7007
BridgeAR merged 15 commits intomasterfrom
simon-id-patch-2

Conversation

@simon-id
Copy link
Copy Markdown
Member

@simon-id simon-id commented Nov 27, 2025

What does this PR do?

Add the eslint rule no-unused-expressions, it prevents stuff like:

function a () {
  if (x) false // forgot the return statement

  blabla()
}

It also allows the use of the void operator, to explicitly allow statements with only side effects.

Motivation

Mistakes have been made in previous PRs that could have been prevented with this rule.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Nov 27, 2025

Overall package size

Self size: 4.56 MB
Deduped: 5.4 MB
No deduping: 5.4 MB

Dependency sizes | name | version | self size | total size | |------|---------|-----------|------------| | import-in-the-middle | 2.0.6 | 81.92 kB | 813.08 kB | | dc-polyfill | 0.1.10 | 26.73 kB | 26.73 kB |

🤖 This report was automatically generated by heaviest-objects-in-the-universe

@codecov
Copy link
Copy Markdown

codecov bot commented Nov 27, 2025

Codecov Report

❌ Patch coverage is 46.66667% with 8 lines in your changes missing coverage. Please review.
✅ Project coverage is 80.41%. Comparing base (5e2f013) to head (b5bbc7a).
⚠️ Report is 4 commits behind head on master.

Files with missing lines Patch % Lines
...ckages/datadog-plugin-azure-functions/src/index.js 0.00% 3 Missing ⚠️
packages/datadog-instrumentations/src/couchbase.js 33.33% 2 Missing ⚠️
packages/datadog-instrumentations/src/dns.js 0.00% 1 Missing ⚠️
...ages/datadog-instrumentations/src/elasticsearch.js 0.00% 1 Missing ⚠️
packages/datadog-instrumentations/src/mysql.js 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #7007      +/-   ##
==========================================
+ Coverage   80.40%   80.41%   +0.01%     
==========================================
  Files         732      732              
  Lines       31050    31050              
==========================================
+ Hits        24965    24970       +5     
+ Misses       6085     6080       -5     
Flag Coverage Δ
aiguard-macos 39.07% <33.33%> (-0.11%) ⬇️
aiguard-ubuntu 39.11% <33.33%> (-0.11%) ⬇️
aiguard-windows 38.96% <33.33%> (-0.11%) ⬇️
apm-capabilities-tracing-macos 48.89% <28.57%> (ø)
apm-capabilities-tracing-ubuntu 48.89% <28.57%> (ø)
apm-capabilities-tracing-windows 48.61% <28.57%> (-0.01%) ⬇️
apm-integrations-child-process 38.56% <66.66%> (-0.11%) ⬇️
apm-integrations-couchbase-18 37.32% <33.33%> (-0.25%) ⬇️
apm-integrations-couchbase-eol 37.80% <50.00%> (-0.25%) ⬇️
apm-integrations-oracledb 37.99% <66.66%> (-0.10%) ⬇️
appsec-express 55.37% <66.66%> (-0.07%) ⬇️
appsec-fastify 51.99% <33.33%> (-0.08%) ⬇️
appsec-graphql 52.31% <40.00%> (-0.07%) ⬇️
appsec-kafka 44.63% <33.33%> (-0.09%) ⬇️
appsec-ldapjs 44.30% <33.33%> (-0.09%) ⬇️
appsec-lodash 43.98% <33.33%> (-0.09%) ⬇️
appsec-macos 58.48% <33.33%> (-0.07%) ⬇️
appsec-mongodb-core 49.18% <33.33%> (-0.08%) ⬇️
appsec-mongoose 49.87% <33.33%> (-0.09%) ⬇️
appsec-mysql 51.26% <50.00%> (-0.08%) ⬇️
appsec-node-serialize 43.49% <33.33%> (-0.09%) ⬇️
appsec-passport 48.10% <33.33%> (-0.09%) ⬇️
appsec-postgres 51.03% <66.66%> (-0.10%) ⬇️
appsec-sourcing 42.84% <33.33%> (-0.09%) ⬇️
appsec-template 43.66% <33.33%> (-0.09%) ⬇️
appsec-ubuntu 58.50% <33.33%> (-0.07%) ⬇️
appsec-windows 58.36% <33.33%> (-0.05%) ⬇️
instrumentations-instrumentation-bluebird 32.23% <33.33%> (-0.11%) ⬇️
instrumentations-instrumentation-body-parser 40.72% <33.33%> (-0.10%) ⬇️
instrumentations-instrumentation-child_process 37.87% <33.33%> (-0.11%) ⬇️
instrumentations-instrumentation-cookie-parser 34.50% <33.33%> (-0.10%) ⬇️
instrumentations-instrumentation-express 34.84% <33.33%> (-0.10%) ⬇️
instrumentations-instrumentation-express-mongo-sanitize 34.63% <33.33%> (-0.10%) ⬇️
instrumentations-instrumentation-express-session 40.40% <33.33%> (-0.10%) ⬇️
instrumentations-instrumentation-fs 31.83% <33.33%> (-0.11%) ⬇️
instrumentations-instrumentation-generic-pool 29.79% <ø> (ø)
instrumentations-instrumentation-http 39.61% <33.33%> (-0.10%) ⬇️
instrumentations-instrumentation-knex 32.24% <33.33%> (-0.11%) ⬇️
instrumentations-instrumentation-mongoose 33.61% <33.33%> (-0.10%) ⬇️
instrumentations-instrumentation-multer 40.46% <33.33%> (-0.10%) ⬇️
instrumentations-instrumentation-mysql2 38.26% <33.33%> (-0.11%) ⬇️
instrumentations-instrumentation-passport 40.76% <33.33%> (-0.10%) ⬇️
instrumentations-instrumentation-passport-http 40.73% <33.33%> (-0.10%) ⬇️
instrumentations-instrumentation-passport-local 40.73% <33.33%> (-0.10%) ⬇️
instrumentations-instrumentation-pg 37.78% <33.33%> (-0.11%) ⬇️
instrumentations-instrumentation-promise 32.16% <33.33%> (-0.11%) ⬇️
instrumentations-instrumentation-promise-js 32.17% <33.33%> (-0.11%) ⬇️
instrumentations-instrumentation-q 32.21% <33.33%> (-0.11%) ⬇️
instrumentations-instrumentation-url 32.13% <33.33%> (-0.11%) ⬇️
instrumentations-instrumentation-when 32.18% <33.33%> (-0.11%) ⬇️
llmobs-ai 41.40% <66.66%> (-0.10%) ⬇️
llmobs-anthropic 40.62% <33.33%> (-0.10%) ⬇️
llmobs-bedrock 39.51% <33.33%> (-0.09%) ⬇️
llmobs-google-genai 40.11% <33.33%> (-0.09%) ⬇️
llmobs-langchain 39.65% <66.66%> (-0.08%) ⬇️
llmobs-openai 44.45% <66.66%> (-0.09%) ⬇️
llmobs-vertex-ai 40.33% <33.33%> (-0.10%) ⬇️
platform-core 28.09% <ø> (ø)
platform-esbuild 31.49% <ø> (ø)
platform-instrumentations-misc 39.62% <ø> (ø)
platform-shimmer 34.83% <ø> (ø)
platform-unit-guardrails 30.37% <ø> (ø)
plugins-azure-event-hubs 22.64% <ø> (ø)
plugins-azure-service-bus 22.08% <ø> (ø)
plugins-bullmq 43.71% <66.66%> (+0.04%) ⬆️
plugins-cassandra 38.03% <66.66%> (-0.10%) ⬇️
plugins-cookie 23.69% <ø> (ø)
plugins-cookie-parser 23.50% <ø> (ø)
plugins-crypto 22.88% <ø> (ø)
plugins-dd-trace-api 38.38% <33.33%> (-0.11%) ⬇️
plugins-express-mongo-sanitize 23.67% <ø> (ø)
plugins-express-session 23.46% <ø> (ø)
plugins-fastify 42.52% <33.33%> (-0.10%) ⬇️
plugins-fetch 38.59% <33.33%> (-0.10%) ⬇️
plugins-fs 38.66% <66.66%> (-0.11%) ⬇️
plugins-generic-pool 22.68% <ø> (ø)
plugins-google-cloud-pubsub 45.70% <33.33%> (-0.12%) ⬇️
plugins-grpc 41.29% <66.66%> (-0.10%) ⬇️
plugins-handlebars 23.71% <ø> (ø)
plugins-hapi 40.42% <33.33%> (-0.10%) ⬇️
plugins-hono 40.62% <33.33%> (-0.10%) ⬇️
plugins-ioredis 38.46% <66.66%> (-0.11%) ⬇️
plugins-knex 23.51% <ø> (ø)
plugins-ldapjs 21.28% <ø> (ø)
plugins-limitd-client 32.38% <33.33%> (-0.26%) ⬇️
plugins-lodash 22.74% <ø> (ø)
plugins-mariadb 39.60% <75.00%> (-0.04%) ⬇️
plugins-memcached 38.19% <66.66%> (-0.11%) ⬇️
plugins-microgateway-core 39.43% <33.33%> (-0.10%) ⬇️
plugins-moleculer 40.83% <66.66%> (-0.10%) ⬇️
plugins-mongodb 39.54% <66.66%> (-0.10%) ⬇️
plugins-mongodb-core 39.12% <33.33%> (-0.10%) ⬇️
plugins-mongoose 39.17% <66.66%> (-0.10%) ⬇️
plugins-multer 23.46% <ø> (ø)
plugins-mysql 39.25% <50.00%> (-0.11%) ⬇️
plugins-mysql2 39.30% <66.66%> (-0.10%) ⬇️
plugins-node-serialize 23.73% <ø> (ø)
plugins-opensearch 37.87% <50.00%> (-0.10%) ⬇️
plugins-postgres 35.70% <66.66%> (-0.09%) ⬇️
plugins-process 22.88% <ø> (ø)
plugins-pug 23.69% <ø> (ø)
plugins-redis 38.78% <66.66%> (-0.11%) ⬇️
plugins-router 43.23% <33.33%> (-0.10%) ⬇️
plugins-sequelize 22.27% <ø> (ø)
plugins-test-and-upstream-amqp10 38.38% <33.33%> (-0.11%) ⬇️
plugins-test-and-upstream-amqplib 43.89% <66.66%> (-0.10%) ⬇️
plugins-test-and-upstream-apollo 39.32% <33.33%> (-0.09%) ⬇️
plugins-test-and-upstream-avsc 38.80% <33.33%> (-0.11%) ⬇️
plugins-test-and-upstream-bunyan 33.85% <33.33%> (-0.11%) ⬇️
plugins-test-and-upstream-connect 41.04% <33.33%> (-0.10%) ⬇️
plugins-test-and-upstream-graphql 40.22% <80.00%> (-0.10%) ⬇️
plugins-test-and-upstream-koa 40.68% <33.33%> (-0.10%) ⬇️
plugins-test-and-upstream-protobufjs 39.04% <33.33%> (-0.11%) ⬇️
plugins-test-and-upstream-rhea 44.15% <66.66%> (-0.13%) ⬇️
plugins-undici 39.39% <33.33%> (-0.10%) ⬇️
plugins-url 22.88% <ø> (ø)
plugins-valkey 38.11% <66.66%> (-0.11%) ⬇️
plugins-vm 22.88% <ø> (ø)
plugins-winston 34.26% <33.33%> (-0.10%) ⬇️
plugins-ws 40.74% <66.66%> (-0.10%) ⬇️
profiling-macos 40.05% <33.33%> (-0.10%) ⬇️
profiling-ubuntu 40.48% <33.33%> (+0.27%) ⬆️
profiling-windows 41.46% <33.33%> (-0.10%) ⬇️
serverless-azure-functions-client 22.38% <ø> (-0.51%) ⬇️
serverless-azure-functions-eventhubs 22.38% <ø> (-0.51%) ⬇️
serverless-azure-functions-servicebus 22.38% <ø> (-0.51%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@pr-commenter
Copy link
Copy Markdown

pr-commenter bot commented Nov 27, 2025

Benchmarks

Benchmark execution time: 2026-02-04 12:43:58

Comparing candidate commit b5bbc7a in PR branch simon-id-patch-2 with baseline commit 5e2f013 in branch master.

Found 0 performance improvements and 0 performance regressions! Performance is the same for 226 metrics, 34 unstable metrics.

@simon-id simon-id changed the title Update eslint.config.mjs chore: add no-unused-expressions lint rule Dec 1, 2025
@simon-id simon-id self-assigned this Dec 1, 2025
@datadog-official

This comment has been minimized.

@simon-id simon-id marked this pull request as ready for review December 2, 2025 12:41
@simon-id simon-id requested review from a team as code owners December 2, 2025 12:41
@simon-id simon-id requested review from khanayan123 and removed request for a team December 2, 2025 12:41
rochdev
rochdev previously approved these changes Dec 2, 2025
@BridgeAR
Copy link
Copy Markdown
Member

Ping @simon-id

Copy link
Copy Markdown
Member Author

@simon-id simon-id left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM @BridgeAR care to approve? i can't since i'm author and last comitter. I made a couple commits, PTAL

@BridgeAR BridgeAR merged commit 313fe22 into master Feb 4, 2026
788 checks passed
@BridgeAR BridgeAR deleted the simon-id-patch-2 branch February 4, 2026 22:09
dd-octo-sts bot pushed a commit that referenced this pull request Feb 5, 2026
Azure functions was in some circumstances attaching the span to
a parent span instead of acting as a root span by missing a
return statement.

Mariadb v2 did not track promise errors in all cases.

This was detected by adding the no-unused-expressions lint rule.

To address confusion, JSDoc was added about childOf being `null`
and its meaning.

In addition, the azure tests are now using the latest version
again, since their library fixed the former support range issue.

The void is now allowed as statement to address issues around e.g.,
`error.stack` access for triggering the stack calculation.
@dd-octo-sts dd-octo-sts bot mentioned this pull request Feb 5, 2026
BridgeAR pushed a commit that referenced this pull request Feb 5, 2026
Azure functions was in some circumstances attaching the span to
a parent span instead of acting as a root span by missing a
return statement.

Mariadb v2 did not track promise errors in all cases.

This was detected by adding the no-unused-expressions lint rule.

To address confusion, JSDoc was added about childOf being `null`
and its meaning.

In addition, the azure tests are now using the latest version
again, since their library fixed the former support range issue.

The void is now allowed as statement to address issues around e.g.,
`error.stack` access for triggering the stack calculation.
bm1549 pushed a commit that referenced this pull request Feb 10, 2026
Azure functions was in some circumstances attaching the span to
a parent span instead of acting as a root span by missing a
return statement.

Mariadb v2 did not track promise errors in all cases.

This was detected by adding the no-unused-expressions lint rule.

To address confusion, JSDoc was added about childOf being `null`
and its meaning.

In addition, the azure tests are now using the latest version
again, since their library fixed the former support range issue.

The void is now allowed as statement to address issues around e.g.,
`error.stack` access for triggering the stack calculation.
BridgeAR pushed a commit that referenced this pull request Feb 22, 2026
Azure functions was in some circumstances attaching the span to
a parent span instead of acting as a root span by missing a
return statement.

Mariadb v2 did not track promise errors in all cases.

This was detected by adding the no-unused-expressions lint rule.

To address confusion, JSDoc was added about childOf being `null`
and its meaning.

In addition, the azure tests are now using the latest version
again, since their library fixed the former support range issue.

The void is now allowed as statement to address issues around e.g.,
`error.stack` access for triggering the stack calculation.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants