Skip to content

Commit

Permalink
fix: use @typescript-eslint/no-unused-vars (#221)
Browse files Browse the repository at this point in the history
- See ipfs/aegir#1459

Aegir currently relies on typescript to perform two linter rules, which is annoying for reasons mentioned in the above issue.
- `noFallthroughCasesInSwitch`
- `noUnusedLocals`

This PR makes typescript rules more strict to enforce both of these conditions.

For `noFallthroughCasesInSwitch`, it appears that the `standard` eslint rule set [already includes](https://github.com/standard/eslint-config-standard/blob/master/src/index.ts#L143) the [`no-fallthrough`](https://eslint.org/docs/latest/rules/no-fallthrough) rule.
So this PR only needs to enforce `noUnusedLocal`, and we just add [`@typescript-eslint/no-unused-vars`](https://typescript-eslint.io/rules/no-unused-vars/).
  • Loading branch information
wemeetagain authored May 1, 2024
1 parent 1f9ebc6 commit 9a95776
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/ts.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ module.exports = {
'@typescript-eslint/await-thenable': 'error', // disallows awaiting a value that is not a "Thenable"
'@typescript-eslint/restrict-template-expressions': 'off', // allow values with `any` type in template literals
'@typescript-eslint/method-signature-style': ['error', 'method'], // enforce method signature style
'no-unused-vars': 'off', // disable this rule to use @typescript-eslint/no-unused-vars instead
'@typescript-eslint/no-unused-vars': 'error', // disallow unused variables
'no-return-await': 'off', // disable this rule to use @typescript-eslint/return-await instead
'@typescript-eslint/return-await': ['error', 'in-try-catch'], // require awaiting thenables returned from try/catch
'jsdoc/require-param': 'off', // do not require jsdoc for params
Expand Down

0 comments on commit 9a95776

Please sign in to comment.