Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: don't disable rule eqeqeq #1978

Merged
merged 7 commits into from
Mar 2, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}, '');
}
Expand All @@ -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<string, BaggageEntry> = {};
if (headerValue.length == 0) {
if (headerValue.length === 0) {
return context;
}
const pairs = headerValue.split(ITEMS_SEPARATOR);
Expand All @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion packages/opentelemetry-core/src/utils/environment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion packages/opentelemetry-metrics/test/Meter.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down