Skip to content

Commit 83591f6

Browse files
committed
Updates linting...
- Fixes missing awaits in try/catch/finally - Renames unused variables
1 parent 42bf69c commit 83591f6

File tree

81 files changed

+235
-251
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

81 files changed

+235
-251
lines changed

.eslintrc.base.json

Lines changed: 9 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -179,43 +179,6 @@
179179
"newlines-between": "never"
180180
}
181181
],
182-
"@typescript-eslint/ban-types": [
183-
"error",
184-
{
185-
"extendDefaults": false,
186-
"types": {
187-
"String": {
188-
"message": "Use string instead",
189-
"fixWith": "string"
190-
},
191-
"Boolean": {
192-
"message": "Use boolean instead",
193-
"fixWith": "boolean"
194-
},
195-
"Number": {
196-
"message": "Use number instead",
197-
"fixWith": "number"
198-
},
199-
"Symbol": {
200-
"message": "Use symbol instead",
201-
"fixWith": "symbol"
202-
},
203-
// "Function": {
204-
// "message": "The `Function` type accepts any function-like value.\nIt provides no type safety when calling the function, which can be a common source of bugs.\nIt also accepts things like class declarations, which will throw at runtime as they will not be called with `new`.\nIf you are expecting the function to accept certain arguments, you should explicitly define the function shape."
205-
// },
206-
"Object": {
207-
"message": "The `Object` type actually means \"any non-nullish value\", so it is marginally better than `unknown`.\n- If you want a type meaning \"any object\", you probably want `Record<string, unknown>` instead.\n- If you want a type meaning \"any value\", you probably want `unknown` instead."
208-
},
209-
"{}": {
210-
"message": "`{}` actually means \"any non-nullish value\".\n- If you want a type meaning \"any object\", you probably want `object` or `Record<string, unknown>` instead.\n- If you want a type meaning \"any value\", you probably want `unknown` instead.",
211-
"fixWith": "object"
212-
}
213-
// "object": {
214-
// "message": "The `object` type is currently hard to use ([see this issue](https://github.com/microsoft/TypeScript/issues/21732)).\nConsider using `Record<string, unknown>` instead, as it allows you to more easily inspect and use the keys."
215-
// }
216-
}
217-
}
218-
],
219182
"@typescript-eslint/consistent-type-assertions": [
220183
"error",
221184
{
@@ -274,6 +237,8 @@
274237
"error",
275238
{ "ignoreArrowShorthand": true, "ignoreVoidOperator": true }
276239
],
240+
"@typescript-eslint/no-duplicate-type-constituents": "off", // Can't control `undefined` so its too noisy
241+
"@typescript-eslint/no-empty-object-type": ["error", { "allowInterfaces": "with-single-extends" }],
277242
"@typescript-eslint/no-explicit-any": "off",
278243
"@typescript-eslint/no-inferrable-types": ["warn", { "ignoreParameters": true, "ignoreProperties": true }],
279244
"@typescript-eslint/no-invalid-void-type": "off", // Seems to error on `void` return types
@@ -282,6 +247,7 @@
282247
"@typescript-eslint/no-redundant-type-constituents": "off",
283248
"@typescript-eslint/no-unnecessary-condition": "off",
284249
"@typescript-eslint/no-unnecessary-boolean-literal-compare": "off",
250+
"@typescript-eslint/no-unnecessary-type-parameters": "off", // https://github.com/typescript-eslint/typescript-eslint/issues/9705
285251
"@typescript-eslint/no-unsafe-argument": "off",
286252
"@typescript-eslint/no-unsafe-assignment": "off",
287253
"@typescript-eslint/no-unsafe-call": "off",
@@ -291,10 +257,13 @@
291257
"@typescript-eslint/no-unused-vars": [
292258
"warn",
293259
{
294-
"args": "after-used",
260+
"args": "all",
295261
"argsIgnorePattern": "^_",
296-
"ignoreRestSiblings": true,
297-
"varsIgnorePattern": "^_$"
262+
"caughtErrors": "all",
263+
"caughtErrorsIgnorePattern": "^_",
264+
"destructuredArrayIgnorePattern": "^_",
265+
"varsIgnorePattern": "^_",
266+
"ignoreRestSiblings": true
298267
}
299268
],
300269
"@typescript-eslint/no-use-before-define": ["error", { "functions": false, "classes": false }],

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18019,8 +18019,8 @@
1801918019
"@types/react-dom": "17.0.21",
1802018020
"@types/sortablejs": "1.15.8",
1802118021
"@types/vscode": "1.82.0",
18022-
"@typescript-eslint/eslint-plugin": "7.18.0",
18023-
"@typescript-eslint/parser": "7.18.0",
18022+
"@typescript-eslint/eslint-plugin": "8.5.0",
18023+
"@typescript-eslint/parser": "8.5.0",
1802418024
"@vscode/test-electron": "2.4.1",
1802518025
"@vscode/test-web": "0.0.60",
1802618026
"@vscode/vsce": "3.1.0",

src/ai/openaiProvider.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,7 @@ Do not make any assumptions or invent details that are not supported by the code
403403
}
404404

405405
try {
406-
return fetch(url, {
406+
return await fetch(url, {
407407
headers: {
408408
Accept: 'application/json',
409409
'Content-Type': 'application/json',

src/annotations/gutterBlameAnnotationProvider.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ export class GutterBlameAnnotationProvider extends BlameAnnotationProviderBase {
5050
}
5151

5252
@log()
53-
override async onProvideAnnotation(context?: AnnotationContext, state?: AnnotationState): Promise<boolean> {
53+
override async onProvideAnnotation(_context?: AnnotationContext, state?: AnnotationState): Promise<boolean> {
5454
const scope = getLogScope();
5555

5656
const blame = await this.getBlame(state?.recompute);

src/annotations/gutterHeatmapBlameAnnotationProvider.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export class GutterHeatmapBlameAnnotationProvider extends BlameAnnotationProvide
2222
}
2323

2424
@log()
25-
override async onProvideAnnotation(context?: AnnotationContext, state?: AnnotationState): Promise<boolean> {
25+
override async onProvideAnnotation(_context?: AnnotationContext, state?: AnnotationState): Promise<boolean> {
2626
const scope = getLogScope();
2727

2828
const blame = await this.getBlame(state?.recompute);

src/api/api.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ export class Api implements GitLensApi {
3232
}
3333

3434
export function preview() {
35-
return (target: any, key: string, descriptor: PropertyDescriptor) => {
35+
return (_target: any, _key: string, descriptor: PropertyDescriptor) => {
36+
// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
3637
let fn: Function | undefined;
3738
if (typeof descriptor.value === 'function') {
3839
fn = descriptor.value;

src/avatars.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ function getAvatarUriFromGitHubNoReplyAddress(email: string, size: number = 16):
213213

214214
async function getAvatarUriFromRemoteProvider(
215215
avatar: Avatar,
216-
key: string,
216+
_key: string,
217217
email: string,
218218
repoPathOrCommit: string | { ref: string; repoPath: string },
219219
{ size = 16 }: { size?: number } = {},

src/commands/base.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -515,7 +515,7 @@ export abstract class EditorCommand implements Disposable {
515515
this._disposable.dispose();
516516
}
517517

518-
private executeCore(command: string, editor: TextEditor, edit: TextEditorEdit, ...args: any[]): any {
518+
private executeCore(_command: string, editor: TextEditor, edit: TextEditorEdit, ...args: any[]): any {
519519
return this.execute(editor, edit, ...args);
520520
}
521521

src/commands/diffWithRevision.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ export class DiffWithRevisionCommand extends ActiveEditorCommand {
111111
picked: gitUri.sha,
112112
keyboard: {
113113
keys: ['right', 'alt+right', 'ctrl+right'],
114-
onDidPressKey: async (key, item) => {
114+
onDidPressKey: async (_key, item) => {
115115
await executeCommand<DiffWithCommandArgs>(Commands.DiffWith, {
116116
repoPath: gitUri.repoPath,
117117
lhs: {

src/commands/diffWithWorking.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ export class DiffWithWorkingCommand extends ActiveEditorCommand {
107107
placeholder: 'Choose another working file to open',
108108
keyboard: {
109109
keys: ['right', 'alt+right', 'ctrl+right'],
110-
onDidPressKey: async (key, uri) => {
110+
onDidPressKey: async (_key, uri) => {
111111
await findOrOpenEditor(uri, { ...args.showOptions, preserveFocus: true, preview: true });
112112
},
113113
},

0 commit comments

Comments
 (0)