Skip to content

Commit 0643642

Browse files
authored
chore: don't disable rule eqeqeq (#1978)
1 parent 51071cd commit 0643642

File tree

7 files changed

+14
-9
lines changed

7 files changed

+14
-9
lines changed

eslint.config.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,10 @@ module.exports = {
1212
},
1313
rules: {
1414
"@typescript-eslint/no-this-alias": "off",
15-
"eqeqeq": "off",
15+
"eqeqeq": [
16+
"error",
17+
"smart"
18+
],
1619
"prefer-rest-params": "off",
1720
"@typescript-eslint/naming-convention": [
1821
"error",

packages/opentelemetry-core/src/baggage/propagation/HttpBaggage.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,9 @@ export class HttpBaggage implements TextMapPropagator {
6363

6464
private _serializeKeyPairs(keyPairs: string[]) {
6565
return keyPairs.reduce((hValue: string, current: string) => {
66-
const value = `${hValue}${hValue != '' ? ITEMS_SEPARATOR : ''}${current}`;
66+
const value = `${hValue}${
67+
hValue !== '' ? ITEMS_SEPARATOR : ''
68+
}${current}`;
6769
return value.length > MAX_TOTAL_LENGTH ? hValue : value;
6870
}, '');
6971
}
@@ -81,7 +83,7 @@ export class HttpBaggage implements TextMapPropagator {
8183
const headerValue: string = getter.get(carrier, BAGGAGE_HEADER) as string;
8284
if (!headerValue) return context;
8385
const baggage: Record<string, BaggageEntry> = {};
84-
if (headerValue.length == 0) {
86+
if (headerValue.length === 0) {
8587
return context;
8688
}
8789
const pairs = headerValue.split(ITEMS_SEPARATOR);
@@ -107,7 +109,7 @@ export class HttpBaggage implements TextMapPropagator {
107109
const keyPairPart = valueProps.shift();
108110
if (!keyPairPart) return;
109111
const keyPair = keyPairPart.split(KEY_PAIR_SEPARATOR);
110-
if (keyPair.length != 2) return;
112+
if (keyPair.length !== 2) return;
111113
const key = decodeURIComponent(keyPair[0].trim());
112114
const value = decodeURIComponent(keyPair[1].trim());
113115
let metadata;

packages/opentelemetry-core/src/utils/environment.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ function setLogLevelFromEnv(
173173
const value = values[key];
174174
if (typeof value === 'string') {
175175
const theLevel = logLevelMap[value.toUpperCase()];
176-
if (theLevel != undefined) {
176+
if (theLevel != null) {
177177
environment[key] = theLevel;
178178
}
179179
}

packages/opentelemetry-exporter-collector/test/common/transformMetrics.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ describe('transformMetrics', () => {
6666
let count3 = 0;
6767

6868
function getValue(count: number) {
69-
if (count % 2 == 0) {
69+
if (count % 2 === 0) {
7070
return 3;
7171
}
7272
return -1;

packages/opentelemetry-instrumentation-fetch/src/fetch.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ export class FetchInstrumentation extends InstrumentationBase<
112112
): void {
113113
const parsedUrl = web.parseUrl(response.url);
114114
span.setAttribute(HttpAttribute.HTTP_STATUS_CODE, response.status);
115-
if (response.statusText != undefined) {
115+
if (response.statusText != null) {
116116
span.setAttribute(HttpAttribute.HTTP_STATUS_TEXT, response.statusText);
117117
}
118118
span.setAttribute(HttpAttribute.HTTP_HOST, parsedUrl.host);

packages/opentelemetry-metrics/test/Meter.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -805,7 +805,7 @@ describe('Meter', () => {
805805

806806
function getValue() {
807807
console.log('getting value, counter:', counter);
808-
if (++counter % 2 == 0) {
808+
if (++counter % 2 === 0) {
809809
return 3;
810810
}
811811
return -1;

packages/opentelemetry-propagator-b3/src/B3SinglePropagator.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ const SAMPLED_VALUES = new Set(['d', '1']);
3737
const DEBUG_STATE = 'd';
3838

3939
function convertToTraceId128(traceId: string): string {
40-
return traceId.length == 32 ? traceId : `${PADDING}${traceId}`;
40+
return traceId.length === 32 ? traceId : `${PADDING}${traceId}`;
4141
}
4242

4343
function convertToTraceFlags(samplingState: string | undefined): TraceFlags {

0 commit comments

Comments
 (0)