question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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:closed
  • Created 4 years ago
  • Comments:9 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
CSBatchelorcommented, Oct 14, 2019

@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 👍

1reaction
CSBatchelorcommented, Oct 13, 2019

I’ll start working on this.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found