Enable the eslint rule `@typescript-eslint/no-unused-vars` in `.eslintrc.js`
See original GitHub issue💡 Idea
Enable the eslint rule @typescript-eslint/no-unused-vars
in .eslintrc.js
.
Consider the rule configuration:
"@typescript-eslint/no-unused-vars": ["error", { "argsIgnorePattern": "^_" }]
Motivation
The rule @typescript-eslint/no-unused-vars
helps to prevent unwanting behaviour by raising red flags when variables are declared but not used.
Example
Example of fix:
describe('AsyncProperty', () => {
it('Should fail if predicate fails', async () => {
--- const p = asyncProperty(stubArb.single(8), async (arg: number) => {
+++ const p = asyncProperty(stubArb.single(8), async (_arg: number) => {
return false;
});
expect(await p.run(p.generate(stubRng.mutable.nocall()).value)).not.toBe(null); // property fails
});
Or:
it('Should drop nothing', () => {
function* g() {
yield* [-4, -2, -3, 1, -8, 7];
}
--- const s = stream(g()).dropWhile(v => false);
+++ const s = stream(g()).dropWhile(_ => false);
expect([...s]).toEqual([-4, -2, -3, 1, -8, 7]);
});
});
How?
As there are 147 errors like this, do not hesitate to split the PR into multiple sub-PRs if it makes the PR clearer.
Please to not hesitate to report strange unused variables.
Issue Analytics
- State:
- Created 4 years ago
- Comments:9 (7 by maintainers)
Top Results From Across the Web
Rules - ESLint - Pluggable JavaScript Linter
Rules are the core building block of ESLint. A rule validates if your code meets a certain expectation, and what to do if...
Read more >Rules - ESLint - Pluggable JavaScript Linter
A pluggable and configurable linter tool for identifying and reporting on patterns in JavaScript. Maintain your code quality with ease.
Read more >Configuring ESLint - ESLint - Pluggable JavaScript Linter
A pluggable and configurable linter tool for identifying and reporting on patterns in JavaScript. Maintain your code quality with ease.
Read more >Getting Started with ESLint - Pluggable JavaScript Linter
ESLint is completely pluggable, every single rule is a plugin and you can add more at runtime. ... You can install and configure...
Read more >Working with Rules - ESLint - Pluggable JavaScript Linter
A pluggable and configurable linter tool for identifying and reporting on patterns in JavaScript. Maintain your code quality with ease.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@Tamy123 I started in test/e2e so I’ll finish those up. Feel free to work on another directory, just let me know so I don’t work on it when I’m done 👍
I’ll start working on this.