Skip to content

Commit a901369

Browse files
authored
Enable eqeqeq ESLint rule and fix violations (#2043)
1 parent b05697c commit a901369

24 files changed

Lines changed: 43 additions & 43 deletions

File tree

extensions/ql-vscode/.eslintrc.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ const baseConfig = {
4949
"@typescript-eslint/no-throw-literal": "error",
5050
"no-useless-escape": 0,
5151
camelcase: "off",
52-
eqeqeq: "off",
5352
"escompat/no-regexp-lookbehind": "off",
5453
"etc/no-implicit-any-catch": "error",
5554
"filenames/match-regex": "off",

extensions/ql-vscode/src/abstract-webview.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ export abstract class AbstractWebview<
5151
}
5252

5353
protected async getPanel(): Promise<WebviewPanel> {
54-
if (this.panel == undefined) {
54+
if (this.panel === undefined) {
5555
const { ctx } = this;
5656

5757
// This is an async method, so in theory this method can be called concurrently. To ensure that we don't

extensions/ql-vscode/src/cli.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,7 @@ export class CodeQLCliServer implements Disposable {
384384
this.killProcessIfRunning();
385385
// Report the error (if there is a stderr then use that otherwise just report the error cod or nodejs error)
386386
const newError =
387-
stderrBuffers.length == 0
387+
stderrBuffers.length === 0
388388
? new Error(`${description} failed: ${err}`)
389389
: new Error(
390390
`${description} failed: ${Buffer.concat(stderrBuffers).toString(

extensions/ql-vscode/src/config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,7 @@ export class QueryServerConfigListener
357357
if (memory === null) {
358358
return undefined;
359359
}
360-
if (memory == 0 || typeof memory !== "number") {
360+
if (memory === 0 || typeof memory !== "number") {
361361
void extLogger.log(
362362
`Ignoring value '${memory}' for setting ${MEMORY_SETTING.qualifiedName}`,
363363
);

extensions/ql-vscode/src/contextual/locationFinder.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -128,9 +128,9 @@ function createTemplates(path: string): Record<string, string> {
128128
function isValidSelect(selectInfo: ResultSetSchema | undefined) {
129129
return (
130130
selectInfo &&
131-
selectInfo.columns.length == 3 &&
132-
selectInfo.columns[0].kind == ColumnKindCode.ENTITY &&
133-
selectInfo.columns[1].kind == ColumnKindCode.ENTITY &&
134-
selectInfo.columns[2].kind == ColumnKindCode.STRING
131+
selectInfo.columns.length === 3 &&
132+
selectInfo.columns[0].kind === ColumnKindCode.ENTITY &&
133+
selectInfo.columns[1].kind === ColumnKindCode.ENTITY &&
134+
selectInfo.columns[2].kind === ColumnKindCode.STRING
135135
);
136136
}

extensions/ql-vscode/src/databases.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -903,7 +903,7 @@ export class DatabaseManager extends DisposableObject {
903903
token: vscode.CancellationToken,
904904
item: DatabaseItem,
905905
) {
906-
if (this._currentDatabaseItem == item) {
906+
if (this._currentDatabaseItem === item) {
907907
this._currentDatabaseItem = undefined;
908908
}
909909
const index = this.databaseItems.findIndex(

extensions/ql-vscode/src/distribution.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -650,10 +650,10 @@ export class ReleasesApiConsumer {
650650
redirectCount < ReleasesApiConsumer._maxRedirects
651651
) {
652652
const parsedRedirectUrl = parse(redirectUrl);
653-
if (parsedRedirectUrl.protocol != "https:") {
653+
if (parsedRedirectUrl.protocol !== "https:") {
654654
throw new Error("Encountered a non-https redirect, rejecting");
655655
}
656-
if (parsedRedirectUrl.host != "api.github.com") {
656+
if (parsedRedirectUrl.host !== "api.github.com") {
657657
// Remove authorization header if we are redirected outside of the GitHub API.
658658
//
659659
// This is necessary to stream release assets since AWS fails if more than one auth

extensions/ql-vscode/src/interface.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ function sortInterpretedResults(
110110
function interpretedPageSize(
111111
interpretation: Interpretation | undefined,
112112
): number {
113-
if (interpretation?.data.t == "GraphInterpretationData") {
113+
if (interpretation?.data.t === "GraphInterpretationData") {
114114
// Graph views always have one result per page.
115115
return 1;
116116
}
@@ -124,7 +124,7 @@ function numPagesOfResultSet(
124124
const pageSize = interpretedPageSize(interpretation);
125125

126126
const n =
127-
interpretation?.data.t == "GraphInterpretationData"
127+
interpretation?.data.t === "GraphInterpretationData"
128128
? interpretation.data.dot.length
129129
: resultSet.schema.rows;
130130

@@ -141,7 +141,7 @@ function numInterpretedPages(
141141
const pageSize = interpretedPageSize(interpretation);
142142

143143
const n =
144-
interpretation.data.t == "GraphInterpretationData"
144+
interpretation.data.t === "GraphInterpretationData"
145145
? interpretation.data.dot.length
146146
: interpretation.data.runs[0].results?.length || 0;
147147

@@ -446,7 +446,7 @@ export class ResultsView extends AbstractWebview<
446446

447447
const selectedTable = getDefaultResultSetName(resultSetNames);
448448
const schema = resultSetSchemas.find(
449-
(resultSet) => resultSet.name == selectedTable,
449+
(resultSet) => resultSet.name === selectedTable,
450450
)!;
451451

452452
// Use sorted results path if it exists. This may happen if we are
@@ -590,7 +590,7 @@ export class ResultsView extends AbstractWebview<
590590
const resultSetNames = allResultSetSchemas.map((schema) => schema.name);
591591

592592
const schema = resultSetSchemas.find(
593-
(resultSet) => resultSet.name == selectedTable,
593+
(resultSet) => resultSet.name === selectedTable,
594594
)!;
595595
if (schema === undefined)
596596
throw new Error(`Query result set '${selectedTable}' not found.`);

extensions/ql-vscode/src/legacy-query-server/run-queries.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ export async function compileAndRunQueryAgainstDatabase(
321321
// This test will produce confusing results if we ever change the name of the database schema files.
322322
const querySchemaName = basename(packConfig.dbscheme);
323323
const dbSchemaName = basename(dbItem.contents.dbSchemeUri.fsPath);
324-
if (querySchemaName != dbSchemaName) {
324+
if (querySchemaName !== dbSchemaName) {
325325
void extLogger.log(
326326
`Query schema was ${querySchemaName}, but database schema was ${dbSchemaName}.`,
327327
);
@@ -403,7 +403,7 @@ export async function compileAndRunQueryAgainstDatabase(
403403
} catch (e) {
404404
if (
405405
e instanceof ResponseError &&
406-
e.code == LSPErrorCodes.RequestCancelled
406+
e.code === LSPErrorCodes.RequestCancelled
407407
) {
408408
return createSyntheticResult(query, "Query cancelled");
409409
} else {
@@ -432,7 +432,7 @@ export async function compileAndRunQueryAgainstDatabase(
432432
query: query.queryEvalInfo,
433433
message,
434434
result,
435-
successful: result.resultType == messages.QueryResultType.SUCCESS,
435+
successful: result.resultType === messages.QueryResultType.SUCCESS,
436436
logFileLocation: result.logFileLocation,
437437
dispose: () => {
438438
qs.logger.removeAdditionalLogLocation(result.logFileLocation);

extensions/ql-vscode/src/log-insights/join-order.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ class JoinOrderScanner implements EvaluationLogScanner {
338338
inLayerEvent.predicateIterationMillis.length <= iteration
339339
? -1
340340
: inLayerEvent.predicateIterationMillis[iteration];
341-
if (iterationTime != -1) {
341+
if (iterationTime !== -1) {
342342
const run: PipelineRun =
343343
inLayerEvent.pipelineRuns[nextPipeline[predicate]++];
344344
func(inLayerEvent, run, iteration);

0 commit comments

Comments
 (0)