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.

I have created a ESLint utility module inspired by eslint-find-rules that I thought you might find useful for eslint-config-airbnb-base and eslint-config-airbnb.

The module is called eslint-index and you can read the full documentation on npm.

eslint-index provides a great deal of functionality including:

  • List all available rules declared by ESLint and any plugins you have included
  • Colour code rules depending on their status:
    • omitted (not declared anywhere in you ESLint config file)
    • 0|off (declared, but set to 0|off)
    • 1|warn
    • 2|error
  • Display links to the rule documentation page next to each rule
  • Filter/reject rules by their status and/or their group
    • status is as described above (omitted|off|warn|error)
    • group is eslint for the core ESLint rules or the name of any of your plugins like react|import|flowtype
  • Format the output as a number or a table to get an overview of your rule settings
  • Rules that have been marked as deprecated are removed from all outputs
  • All of the above filters and formatting can be combined, for example:
    • filter omitted and off rules, output them as a list and display the rule doc links alongside
    • filter eslint rules and display the rule setting counters in a table

I wrote this plugin to aid the development of my own ESLint config settings and found it incredibly useful for keeping track of everything. I hope you find this module useful and please do let me know if you have any ideas on how to improve it.

Issue Analytics

  • State:open
  • Created 7 years ago
  • Reactions:2
  • Comments:6

github_iconTop GitHub Comments

3reactions
wagerfieldcommented, Jan 12, 2017

I developed the tool to assist me in writing a config for my company (eslint-config-supermind). With so many rules available in ESLint itself plus all the rules provided by plugins, I found it difficult to keep track of which rules I had used and which ones I hadn’t. This became all the more difficult when upgrading eslint and any plugins—I wouldn’t know what new rules had been added.

eslint-find-rules went a long way in helping with this, but I felt it lacked the granular functionality I desired—so I developed eslint-index. Being able to filter rules by status (omitted|off|warn|error), by plugin (react|jsx-a11y) or the core eslint rules and having doc urls outputted alongside rules in the console has been very useful to me.

For example, if I upgrade eslint or any plugins and want to see which rules I haven’t specified (because they are new) and for these omitted rules, display links to the docs alongside, I can do:

eslint-index .eslintrc.js --status omitted --docs
0reactions
ljharbcommented, Jan 11, 2017

Correct - that’s what i’m hoping for 😃

Absent that, this tool might still be very useful, but I haven’t yet grasped what specific problem it solves for me.

Read more comments on GitHub >

github_iconTop Results From Across the Web

eslint-index - npm
ESLint Index. CLI for finding and managing rules in ESLint config files. List all the rules! Demo 1. Then count them, or ...
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 >
eslint-plugin-react/no-array-index-key.md at master - GitHub
The key is used by React to identify which items have changed, are added, or are removed and should be stable. It's a...
Read more >
create-eslint-index - npm Package Health Analysis - Snyk
Learn more about create-eslint-index: package health score, popularity, security, maintenance, versions and more.
Read more >
consistent-indexed-object-style - TypeScript ESLint
"index-signature" : only allow index signatures. record ​. ❌ Incorrect; ✓ Correct. /* eslint @typescript-eslint ...
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