diff --git a/eslint.config.js b/eslint.config.js index 663e6b32adf..41a00792995 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -12,7 +12,10 @@ module.exports = { }, rules: { "@typescript-eslint/no-this-alias": "off", - "eqeqeq": "off", + "eqeqeq": [ + "error", + "smart" + ], "prefer-rest-params": "off", "@typescript-eslint/naming-convention": [ "error", diff --git a/packages/opentelemetry-core/src/baggage/propagation/HttpBaggage.ts b/packages/opentelemetry-core/src/baggage/propagation/HttpBaggage.ts index 6b40dcf66e8..8b2b309ac33 100644 --- a/packages/opentelemetry-core/src/baggage/propagation/HttpBaggage.ts +++ b/packages/opentelemetry-core/src/baggage/propagation/HttpBaggage.ts @@ -63,7 +63,9 @@ export class HttpBaggage implements TextMapPropagator { private _serializeKeyPairs(keyPairs: string[]) { return keyPairs.reduce((hValue: string, current: string) => { - const value = `${hValue}${hValue != '' ? ITEMS_SEPARATOR : ''}${current}`; + const value = `${hValue}${ + hValue !== '' ? ITEMS_SEPARATOR : '' + }${current}`; return value.length > MAX_TOTAL_LENGTH ? hValue : value; }, ''); } @@ -81,7 +83,7 @@ export class HttpBaggage implements TextMapPropagator { const headerValue: string = getter.get(carrier, BAGGAGE_HEADER) as string; if (!headerValue) return context; const baggage: Record = {}; - if (headerValue.length == 0) { + if (headerValue.length === 0) { return context; } const pairs = headerValue.split(ITEMS_SEPARATOR); @@ -107,7 +109,7 @@ export class HttpBaggage implements TextMapPropagator { const keyPairPart = valueProps.shift(); if (!keyPairPart) return; const keyPair = keyPairPart.split(KEY_PAIR_SEPARATOR); - if (keyPair.length != 2) return; + if (keyPair.length !== 2) return; const key = decodeURIComponent(keyPair[0].trim()); const value = decodeURIComponent(keyPair[1].trim()); let metadata; diff --git a/packages/opentelemetry-core/src/utils/environment.ts b/packages/opentelemetry-core/src/utils/environment.ts index ad67f440a3b..c353a386731 100644 --- a/packages/opentelemetry-core/src/utils/environment.ts +++ b/packages/opentelemetry-core/src/utils/environment.ts @@ -173,7 +173,7 @@ function setLogLevelFromEnv( const value = values[key]; if (typeof value === 'string') { const theLevel = logLevelMap[value.toUpperCase()]; - if (theLevel != undefined) { + if (theLevel != null) { environment[key] = theLevel; } } diff --git a/packages/opentelemetry-exporter-collector/test/common/transformMetrics.test.ts b/packages/opentelemetry-exporter-collector/test/common/transformMetrics.test.ts index 30ede3ffd2f..14203f5d604 100644 --- a/packages/opentelemetry-exporter-collector/test/common/transformMetrics.test.ts +++ b/packages/opentelemetry-exporter-collector/test/common/transformMetrics.test.ts @@ -66,7 +66,7 @@ describe('transformMetrics', () => { let count3 = 0; function getValue(count: number) { - if (count % 2 == 0) { + if (count % 2 === 0) { return 3; } return -1; diff --git a/packages/opentelemetry-instrumentation-fetch/src/fetch.ts b/packages/opentelemetry-instrumentation-fetch/src/fetch.ts index 033b6b92eeb..5aa369d82b9 100644 --- a/packages/opentelemetry-instrumentation-fetch/src/fetch.ts +++ b/packages/opentelemetry-instrumentation-fetch/src/fetch.ts @@ -112,7 +112,7 @@ export class FetchInstrumentation extends InstrumentationBase< ): void { const parsedUrl = web.parseUrl(response.url); span.setAttribute(HttpAttribute.HTTP_STATUS_CODE, response.status); - if (response.statusText != undefined) { + if (response.statusText != null) { span.setAttribute(HttpAttribute.HTTP_STATUS_TEXT, response.statusText); } span.setAttribute(HttpAttribute.HTTP_HOST, parsedUrl.host); diff --git a/packages/opentelemetry-metrics/test/Meter.test.ts b/packages/opentelemetry-metrics/test/Meter.test.ts index 465f5b83013..b1ad16d701c 100644 --- a/packages/opentelemetry-metrics/test/Meter.test.ts +++ b/packages/opentelemetry-metrics/test/Meter.test.ts @@ -805,7 +805,7 @@ describe('Meter', () => { function getValue() { console.log('getting value, counter:', counter); - if (++counter % 2 == 0) { + if (++counter % 2 === 0) { return 3; } return -1; diff --git a/packages/opentelemetry-propagator-b3/src/B3SinglePropagator.ts b/packages/opentelemetry-propagator-b3/src/B3SinglePropagator.ts index 91f8d7d00db..8e751cfb799 100644 --- a/packages/opentelemetry-propagator-b3/src/B3SinglePropagator.ts +++ b/packages/opentelemetry-propagator-b3/src/B3SinglePropagator.ts @@ -37,7 +37,7 @@ const SAMPLED_VALUES = new Set(['d', '1']); const DEBUG_STATE = 'd'; function convertToTraceId128(traceId: string): string { - return traceId.length == 32 ? traceId : `${PADDING}${traceId}`; + return traceId.length === 32 ? traceId : `${PADDING}${traceId}`; } function convertToTraceFlags(samplingState: string | undefined): TraceFlags {