Skip to content

Commit fabd795

Browse files
authored
Add eslint rule: Disallow unused variables (#118)
1 parent 14ef897 commit fabd795

37 files changed

+55
-39
lines changed

.eslintrc.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,12 @@ module.exports = {
5353
],
5454
},
5555
],
56+
"no-unused-vars": ["error", {
57+
"vars": "all",
58+
"args": "none",
59+
"caughtErrors": "all",
60+
"ignoreRestSiblings": false,
61+
}],
5662
'brace-style': 'off',
5763
curly: 'error',
5864
eqeqeq: ['error', 'always'],

src/atlclients/responseHandlers/BitbucketResponseHandler.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ export class BitbucketResponseHandler extends ResponseHandler {
6464
email = primary[0].email;
6565
}
6666
}
67-
} catch (e) {
67+
} catch {
6868
//ignore
6969
}
7070

src/bitbucket/bitbucket-cloud/pullRequests.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,7 @@ export class CloudPullRequestApi implements PullRequestApi {
353353
}
354354

355355
return accumulatedTasks.map((task: any) => this.convertDataToTask(task, pr.site));
356-
} catch (e) {
356+
} catch {
357357
return [];
358358
}
359359
}
@@ -624,7 +624,7 @@ export class CloudPullRequestApi implements PullRequestApi {
624624
});
625625

626626
return (data.values || []).map((reviewer: any) => CloudPullRequestApi.toUserModel(reviewer.user));
627-
} catch (e) {
627+
} catch {
628628
return [];
629629
}
630630
}
@@ -648,7 +648,7 @@ export class CloudPullRequestApi implements PullRequestApi {
648648
}
649649

650650
return teamMembers.map((m: any) => CloudPullRequestApi.toUserModel(m.user));
651-
} catch (e) {
651+
} catch {
652652
return [];
653653
}
654654
}

src/bitbucket/bitbucket-server/pullRequests.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -639,7 +639,7 @@ export class ServerPullRequestApi implements PullRequestApi {
639639
} else {
640640
return 1;
641641
}
642-
} catch (e) {
642+
} catch {
643643
return a.ts!! ? 1 : -1;
644644
}
645645
}),

src/bitbucket/bitbucket-server/repositories.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export class ServerRepositoriesApi implements RepositoriesApi {
1414
const { data } = await this.client.get(`/rest/mirroring/1.0/mirrorServers?limit=100`);
1515

1616
return data.values.map((val: any) => new URL(val.baseUrl).hostname);
17-
} catch (e) {
17+
} catch {
1818
// ignore
1919
}
2020
return [];

src/commands/jira/showIssue.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ export async function showIssueForKey(issueKey?: string) {
7070
if (issueKey) {
7171
try {
7272
issue = await issueForKey(issueKey);
73-
} catch (e) {
73+
} catch {
7474
//not found
7575
}
7676
}

src/jira/projectManager.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export class JiraProjectManager extends Disposable {
3232
try {
3333
const client = await Container.clientManager.jiraClient(site);
3434
return await client.getProject(projectKey);
35-
} catch (e) {
35+
} catch {
3636
//continue
3737
}
3838

@@ -45,7 +45,7 @@ export class JiraProjectManager extends Disposable {
4545
if (projects.length > 0) {
4646
return projects[0];
4747
}
48-
} catch (e) {
48+
} catch {
4949
//continue
5050
}
5151

src/lib/webview/controller/startwork/startWorkWebviewController.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ export class StartWorkWebviewController implements WebviewController<StartWorkIs
193193
imgData: imgData,
194194
nonce: msg.nonce,
195195
} as any);
196-
} catch (e) {
196+
} catch {
197197
this.logger.error(new Error(`error fetching image: ${msg.url}`));
198198
this.postMessage({
199199
type: 'getImageDone',

src/react/atlascode/common/form/useFormValidation.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ export function useFormValidation<FieldTypes>(watch?: Partial<FieldTypes>): Form
8686
const watchDefaults = useRef<Partial<FieldTypes>>(watch ? watch : {});
8787
const watches = useRef<Partial<FieldTypes>>(watch ? watch : {});
8888
const errors = useRef<Partial<Errors<FieldTypes>>>({});
89-
const [_toggle, reRender] = useState(false);
89+
const [, reRender] = useState(false);
9090

9191
const handleChange = useConstant(() => async (e: Event) => {
9292
const field = fields[(e.target as InputElement).name];

src/react/atlascode/config/auth/dialog/AuthDialog.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ function isCustomUrl(url: string): boolean {
237237
try {
238238
const urlObj = new URL(url);
239239
return cloudHostnames.every((host) => !urlObj.hostname.endsWith(host));
240-
} catch (e) {
240+
} catch {
241241
return false;
242242
}
243243
}

0 commit comments

Comments
 (0)