Skip to content

Commit b501a04

Browse files
Fix linting errors resulting from upgrading @typescript-eslint/eslint-plugin to version 8
1 parent c90f805 commit b501a04

File tree

30 files changed

+92
-86
lines changed

30 files changed

+92
-86
lines changed

extensions/ql-vscode/.eslintignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,14 @@ node_modules/
33
out/
44
build/
55

6+
# Ignore js files
7+
.eslintrc.js
8+
jest.config.js
9+
test/vscode-tests/activated-extension/jest-runner-vscode.config.js
10+
test/vscode-tests/cli-integration/jest-runner-vscode.config.js
11+
test/vscode-tests/jest-runner-vscode.config.base.js
12+
test/vscode-tests/minimal-workspace/jest-runner-vscode.config.js
13+
test/vscode-tests/no-workspace/jest-runner-vscode.config.js
14+
615
# Include the Storybook config
716
!.storybook

extensions/ql-vscode/.eslintrc.js

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ const baseConfig = {
4545
"@typescript-eslint/no-invalid-this": "off",
4646
"@typescript-eslint/no-shadow": "off",
4747
"prefer-const": ["warn", { destructuring: "all" }],
48-
"@typescript-eslint/no-throw-literal": "error",
48+
"@typescript-eslint/only-throw-error": "error",
4949
"@typescript-eslint/consistent-type-imports": "error",
5050
"import/consistent-type-specifier-style": ["error", "prefer-top-level"],
5151
curly: ["error", "all"],
@@ -133,18 +133,7 @@ module.exports = {
133133
...baseConfig.rules,
134134
// We want to allow mocking of functions in modules, so we need to allow namespace imports.
135135
"import/no-namespace": "off",
136-
"@typescript-eslint/ban-types": [
137-
"error",
138-
{
139-
// For a full list of the default banned types, see:
140-
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/ban-types.md
141-
extendDefaults: true,
142-
types: {
143-
// Don't complain about the `Function` type in test files. (Default is `true`.)
144-
Function: false,
145-
},
146-
},
147-
],
136+
"@typescript-eslint/no-unsafe-function-type": "off",
148137
},
149138
},
150139
{

extensions/ql-vscode/gulpfile.ts/appInsights.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { src, dest } from "gulp";
2-
// eslint-disable-next-line @typescript-eslint/no-var-requires,import/no-commonjs
2+
// eslint-disable-next-line @typescript-eslint/no-require-imports,import/no-commonjs
33
const replace = require("gulp-replace");
44

55
/** Inject the application insights key into the telemetry file */

extensions/ql-vscode/src/codeql-cli/cli.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -943,7 +943,7 @@ export class CodeQLCliServer implements Disposable {
943943
if (line.startsWith("Enter value for --github-auth-stdin")) {
944944
try {
945945
return await this.app.credentials.getAccessToken();
946-
} catch (e) {
946+
} catch {
947947
// If the user cancels the authentication prompt, we still need to give a value to the CLI.
948948
// By giving a potentially invalid value, the user will just get a 401/403 when they try to access a
949949
// private package and the access token is invalid.

extensions/ql-vscode/src/codeql-cli/query-language.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ export async function findLanguage(
3636
void extLogger.log(
3737
"Query language is unsupported. Select language manually.",
3838
);
39-
} catch (e) {
39+
} catch {
4040
void extLogger.log(
4141
"Could not autodetect query language. Select language manually.",
4242
);

extensions/ql-vscode/src/common/github-url-identifier-helper.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ function getNwoOrOwnerFromGitHubUrl(
7878
}
7979
const nwo = `${paths[0]}/${paths[1]}`;
8080
return paths[1] ? nwo : undefined;
81-
} catch (e) {
81+
} catch {
8282
// Ignore the error here, since we catch failures at a higher level.
8383
return;
8484
}

extensions/ql-vscode/src/common/readonly.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
export type DeepReadonly<T> =
22
T extends Array<infer R>
33
? DeepReadonlyArray<R>
4-
: // eslint-disable-next-line @typescript-eslint/ban-types
4+
: // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
55
T extends Function
66
? T
77
: T extends object
88
? DeepReadonlyObject<T>
99
: T;
1010

11-
interface DeepReadonlyArray<T> extends ReadonlyArray<DeepReadonly<T>> {}
11+
type DeepReadonlyArray<T> = ReadonlyArray<DeepReadonly<T>>;
1212

1313
type DeepReadonlyObject<T> = {
1414
readonly [P in keyof T]: DeepReadonly<T[P]>;

extensions/ql-vscode/src/databases/config/db-config-store.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ export class DbConfigStore extends DisposableObject {
298298
let newConfig: DbConfig | undefined = undefined;
299299
try {
300300
newConfig = await readJSON(this.configPath);
301-
} catch (e) {
301+
} catch {
302302
this.configErrors = [
303303
{
304304
kind: DbConfigValidationErrorKind.InvalidJson,
@@ -332,7 +332,7 @@ export class DbConfigStore extends DisposableObject {
332332
let newConfig: DbConfig | undefined = undefined;
333333
try {
334334
newConfig = readJSONSync(this.configPath);
335-
} catch (e) {
335+
} catch {
336336
this.configErrors = [
337337
{
338338
kind: DbConfigValidationErrorKind.InvalidJson,

extensions/ql-vscode/src/databases/database-fetcher.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,7 @@ export class DatabaseFetcher {
454454
let uri;
455455
try {
456456
uri = Uri.parse(databaseUrl, true);
457-
} catch (e) {
457+
} catch {
458458
throw new Error(`Invalid url: ${databaseUrl}`);
459459
}
460460

@@ -612,7 +612,7 @@ export class DatabaseFetcher {
612612
const obj = JSON.parse(text);
613613
msg =
614614
obj.error || obj.message || obj.reason || JSON.stringify(obj, null, 2);
615-
} catch (e) {
615+
} catch {
616616
msg = text;
617617
}
618618
throw new Error(`${errorMessage}.\n\nReason: ${msg}`);

extensions/ql-vscode/src/databases/local-databases/database-manager.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ export class DatabaseManager extends DisposableObject {
231231
let originStat;
232232
try {
233233
originStat = await stat(originDbYml);
234-
} catch (e) {
234+
} catch {
235235
// if there is an error here, assume that the origin database
236236
// is no longer available. Safely ignore and do not try to re-import.
237237
return false;
@@ -240,7 +240,7 @@ export class DatabaseManager extends DisposableObject {
240240
try {
241241
const importedStat = await stat(importedDbYml);
242242
return originStat.mtimeMs > importedStat.mtimeMs;
243-
} catch (e) {
243+
} catch {
244244
// If either of the files does not exist, we assume the origin is newer.
245245
// This shouldn't happen unless the user manually deleted one of the files.
246246
return true;

0 commit comments

Comments
 (0)