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.

'extends: eslint:recommended' causes *all* rules to be considered used

See original GitHub issue

Take the following minimal .eslintrc.yaml:

extends: eslint:recommended

When I run eslint-find-rules -c .eslintrc.yaml it dumps a list of every eslint rule, which is extremely unhelpful.

I think the problem here is that eslint:recommended is implemented by setting the value for non-recommended rules to off instead of leaving them out. The only workaround I can think of for this is to explicitly mask out eslint:recommended and then later fill them back in. However, this seems like a bit of a bodge; is there a better way to do this?

The alternative is to add a flag such as --off-is-unused to consider any rules which have been turned off to be unused. Of course, that would prevent rules from being removed from the list.

Issue Analytics

  • State:open
  • Created 7 years ago
  • Reactions:1
  • Comments:8

github_iconTop GitHub Comments

1reaction
ljharbcommented, Oct 18, 2016

I think that if you want the recommended set to only list the rules it’s enabling, that perhaps that’s a change that should be made upstream in eslint itself?

0reactions
ta2edchimpcommented, Sep 4, 2017

Definitely.

But as I do not have the perfect idea about how to approach this, I’d recommend to use eslint-diff-rules in verbose mode as a workaround in the meanwhile:

eslint-diff-rules [your own config] ./node_modles/eslint/conf/eslint-recommended.js -v

Read more comments on GitHub >

github_iconTop Results From Across the Web

Rules - ESLint - Pluggable JavaScript Linter
Rules in ESLint are grouped by type to help you understand their purpose. Each rule has emojis denoting: ✓ Recommended. The "extends": "eslint:recommended" ......
Read more >
What are Eslint rules? - Dev Genius
Rules are restrictions that a given block of code must follow. Eslint comes with its own set of rules but you can create...
Read more >
What is the difference between extends and plugins in ESLint ...
Although ESLint ships with some good set of rules, usually they are not enough to cover all the needs for your project, especially...
Read more >
eslint-config-prettier - GitHub
GitHub - prettier/eslint-config-prettier: Turns off all rules that are unnecessary or might ... Put "plugin:prettier/recommended" in your "extends" .
Read more >
12 essential ESLint rules for React - LogRocket Blog
To use the recommended rule set, just add 'plugin:react/recommended' to your ESLint configuration's extends section:
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