diff --git a/eslint.config.mjs b/eslint.config.mjs index be9763c6576..44dee2771e0 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -420,7 +420,9 @@ export default [ 'no-await-in-loop': 'error', 'no-else-return': ['error', { allowElseIf: true }], 'no-implicit-coercion': ['error', { boolean: true, number: true, string: true, allow: ['!!'] }], + 'no-unused-expressions': 'error', 'no-useless-assignment': 'error', + 'no-void': 'off', 'operator-assignment': 'error', 'prefer-exponentiation-operator': 'error', 'prefer-object-has-own': 'error', diff --git a/packages/datadog-instrumentations/src/couchbase.js b/packages/datadog-instrumentations/src/couchbase.js index 7a648b7ef71..3dbf332ecd9 100644 --- a/packages/datadog-instrumentations/src/couchbase.js +++ b/packages/datadog-instrumentations/src/couchbase.js @@ -96,7 +96,7 @@ function wrap (prefix, fn) { return fn.apply(this, arguments) } catch (error) { ctx.error = error - error.stack // trigger getting the stack at the original throwing point + void error.stack // trigger getting the stack at the original throwing point errorCh.publish(ctx) throw error @@ -162,7 +162,7 @@ function wrapCBandPromise (fn, name, startData, thisArg, args) { ) return res } catch (e) { - e.stack + void e.stack ctx.error = e errorCh.publish(ctx) throw e @@ -226,7 +226,7 @@ addHook({ name: 'couchbase', file: 'lib/bucket.js', versions: ['^2.6.12'] }, Buc try { return _n1qlReq.apply(this, arguments) } catch (err) { - err.stack // trigger getting the stack at the original throwing point + void err.stack // trigger getting the stack at the original throwing point ctx.error = err errorCh.publish(ctx) diff --git a/packages/datadog-instrumentations/src/dns.js b/packages/datadog-instrumentations/src/dns.js index ac37784c58d..3010911cc55 100644 --- a/packages/datadog-instrumentations/src/dns.js +++ b/packages/datadog-instrumentations/src/dns.js @@ -85,7 +85,7 @@ function wrap (prefix, fn, expectedArgs, rrtype) { return fn.apply(this, arguments) // TODO deal with promise versions when we support `dns/promises` } catch (error) { - error.stack // trigger getting the stack at the original throwing point + void error.stack // trigger getting the stack at the original throwing point ctx.error = error errorCh.publish(ctx) diff --git a/packages/datadog-instrumentations/src/elasticsearch.js b/packages/datadog-instrumentations/src/elasticsearch.js index 9cc7434e7d9..4a6ab62b84a 100644 --- a/packages/datadog-instrumentations/src/elasticsearch.js +++ b/packages/datadog-instrumentations/src/elasticsearch.js @@ -99,7 +99,7 @@ function createWrapRequest (name) { } return promise } catch (err) { - err.stack // trigger getting the stack at the original throwing point + void err.stack // trigger getting the stack at the original throwing point errorCh.publish(err) throw err diff --git a/packages/datadog-instrumentations/src/graphql.js b/packages/datadog-instrumentations/src/graphql.js index 2568661d4c7..84fffe66355 100644 --- a/packages/datadog-instrumentations/src/graphql.js +++ b/packages/datadog-instrumentations/src/graphql.js @@ -103,7 +103,7 @@ function wrapParse (parse) { return ctx.document } catch (err) { - err.stack + void err.stack ctx.error = err parseErrorCh.publish(ctx) @@ -132,7 +132,7 @@ function wrapValidate (validate) { } return errors } catch (err) { - err.stack + void err.stack ctx.error = err validateErrorCh.publish(ctx) diff --git a/packages/datadog-instrumentations/src/mariadb.js b/packages/datadog-instrumentations/src/mariadb.js index bd3bb1334f2..a4deb69f7ce 100644 --- a/packages/datadog-instrumentations/src/mariadb.js +++ b/packages/datadog-instrumentations/src/mariadb.js @@ -66,7 +66,7 @@ function createWrapQuery (options) { finishCh.publish(ctx) return result }, error => { - ctx.error + ctx.error = error errorCh.publish(ctx) finishCh.publish(ctx) throw error diff --git a/packages/datadog-instrumentations/src/mysql.js b/packages/datadog-instrumentations/src/mysql.js index 5710b81d34a..b7bf01e8704 100644 --- a/packages/datadog-instrumentations/src/mysql.js +++ b/packages/datadog-instrumentations/src/mysql.js @@ -44,7 +44,7 @@ addHook({ name: 'mysql', file: 'lib/Connection.js', versions: ['>=2'] }, Connect return res } catch (err) { - err.stack // trigger getting the stack at the original throwing point + void err.stack // trigger getting the stack at the original throwing point ctx.error = err errorCh.publish(ctx) diff --git a/packages/datadog-plugin-azure-functions/src/index.js b/packages/datadog-plugin-azure-functions/src/index.js index 2203753dd84..d33f03fbd33 100644 --- a/packages/datadog-plugin-azure-functions/src/index.js +++ b/packages/datadog-plugin-azure-functions/src/index.js @@ -117,7 +117,7 @@ function extractTraceContext (tracer, ctx) { case 'Http': return tracer.extract('http_headers', Object.fromEntries(ctx.httpRequest.headers)) default: - null + return null } } diff --git a/packages/dd-trace/src/opentracing/propagation/text_map.js b/packages/dd-trace/src/opentracing/propagation/text_map.js index 3d7668dfcd3..baffcab94c6 100644 --- a/packages/dd-trace/src/opentracing/propagation/text_map.js +++ b/packages/dd-trace/src/opentracing/propagation/text_map.js @@ -129,8 +129,8 @@ class TextMapPropagator { } _injectBaggageItems (spanContext, carrier) { - if (this._config.legacyBaggageEnabled) { - spanContext?._baggageItems && Object.keys(spanContext._baggageItems).forEach(key => { + if (this._config.legacyBaggageEnabled && spanContext?._baggageItems) { + Object.keys(spanContext._baggageItems).forEach(key => { carrier[baggagePrefix + key] = String(spanContext._baggageItems[key]) }) } diff --git a/packages/dd-trace/src/remote_config/scheduler.js b/packages/dd-trace/src/remote_config/scheduler.js index 65460a1e4e3..80fbab33333 100644 --- a/packages/dd-trace/src/remote_config/scheduler.js +++ b/packages/dd-trace/src/remote_config/scheduler.js @@ -17,7 +17,7 @@ class Scheduler { runAfterDelay (interval = this._interval) { this._timer = setTimeout(this._callback, interval, () => this.runAfterDelay()) - this._timer.unref && this._timer.unref() + this._timer.unref() } stop () {