eslint-find-rules
Find built-in ESLint rules you don't have in your custom config.
Last updated 3 years ago by ljharb .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ gnpm install eslint-find-rules 
SYNC missed versions from official npm registry.

eslint-find-rules

Join the chat at https://gitter.im/sarbbottam/eslint-find-rules

Use this for your own ESLint shareable configuration to list current configured rules, all-available rules, unused rules, and plugin rules.

Build Status Code Coverage version downloads MIT License PRs Welcome All Contributors

Acknowledgment

This module is an extended version of eslint-find-new-rules

Installation

Simply install locally as a development dependency to your project's package:

npm install --save-dev eslint-find-rules

Usage

It is expected to be used as local utility, as it needs eslint and the eslint-plugins being referred by the eslint-config file, to be installed. Using it as a global utility, will error out, if eslint and the eslint-plugins being referred by the eslint-config file, are not installed globally.

The intended usage is as an npm script:

{
  ...
  "scripts": {
    "eslint-find-option-rules": "eslint-find-rules [option] <file> [flag]"
  }
  ...
}

Then run it with: $ npm run --silent eslint-find-option-rules (the --silent is to silence npm output).

available options are -a|--all-available, -c|--current, -d|--deprecated, -p|--plugin, -u|--unused
available flags are -n|--no-error, --no-core, -i/--include deprecated, and --ext .js

By default it will error out only for -d|--deprecated and -u|--unused, however if you do not want the process to exit with a non-zero exit code, use the -n|--no-error flag along with -d|--deprecated or -u|--unused.

By default, core rules will be included in the output of -a|--all-available, -c|--current, -d|--deprecated, and -u|--unused. If you want to report on plugin rules only, use the --no-core flag.

By default, deprecated rules will be omitted from the output of -a|--all-available, -p|--plugin and -u|--unused. If you want to report on deprecated rules as well, use the --include=deprecated or -i deprecated flag.

By default, rules will be searched for files having .js extension. If you want to find rules using another extension (.json for example), use the --ext .json flag (or --ext .js --ext .json if you need multiple extensions).

NOTE: Deprecated rules are found by looking at the metadata of the rule definition. All core rules and many plugin rules use this flag to indicate deprecated rules. But if you find a plugin that does not mark their rules as deprecated in the rule metadata, please file a pull request with that project.

Specify a file

This is really handy in an actual config module (like eslint-config-kentcdodds) where you could also do:

// available options are -a|--all-available, -c|--current, -d|--deprecated, -p|--plugin, -u|--unused
eslint-find-rules --option ./index.js

This is resolved, relative to the process.cwd() which, in the context of npm scripts is always the location of your package.json.

You may specify any config format supported by ESLint.

Absolute Path

You can also provide an absolute path:

eslint-find-rules --option ~/Developer/eslint-config-kentcdodds/index.js

Please note that any tested ESLint config file must reside below your project's root.

Default to main

It will also default to the main in your package.json, so you can omit the path/to/file argument:

eslint-find-rules --option

As a required module

var getRuleFinder = require('./eslint-find-rules')
var ruleFinder = getRuleFinder('path/to/eslint-config')

// default to the `main` in your `package.json`
// var ruleFinder = await getRuleFinder()

// get all the current, plugin, available and unused rules
// without referring the extended files or documentation

ruleFinder.getCurrentRules()

ruleFinder.getCurrentRulesDetailed()

ruleFinder.getPluginRules()

ruleFinder.getAllAvailableRules()

ruleFinder.getUnusedRules()

ruleFinder.getDeprecatedRules()

Log the difference between two config files

{
  ...
  "scripts": {
    "eslint-diff-rules": "eslint-diff-rules <file1> <file2>"
  }
  ...
}

Contributors

Thanks goes to these wonderful people (emoji key):


Sarbbottam Bandyopadhyay

???? ???? ⚠️ ????

Andreas Windt

???? ???? ⚠️ ????

Kent C. Dodds

???? ???? ⚠️ ????

Scott Nonnenberg

???? ⚠️

Michał Gołębiowski

????

Jeroen Engels

????

Dustin Specker

????

Randy Coulman

???? ⚠️

Jordan Harband

???? ???? ???? ???? ???? ⚠️ ????

Brad Zacher

???? ⚠️

This project follows the all-contributors specification. Contributions of any kind welcome!

Special thanks to @mgol who created the original script.

LICENSE

MIT

Current Tags

  • 4.1.0                                ...           latest (3 years ago)

40 Versions

  • 4.1.0                                ...           3 years ago
  • 4.0.0                                ...           3 years ago
  • 3.6.1                                ...           4 years ago
  • 3.6.0                                ...           4 years ago
  • 3.5.0                                ...           5 years ago
  • 3.4.0                                ...           5 years ago
  • 3.3.1                                ...           6 years ago
  • 3.2.3                                ...           7 years ago
  • 3.2.2                                ...           7 years ago
  • 3.2.1                                ...           7 years ago
  • 3.2.0                                ...           7 years ago
  • 3.1.1                                ...           7 years ago
  • 3.1.0                                ...           7 years ago
  • 3.0.0                                ...           7 years ago
  • 2.1.0                                ...           7 years ago
  • 2.0.1                                ...           7 years ago
  • 2.0.0                                ...           7 years ago
  • 1.14.3                                ...           8 years ago
  • 1.14.2                                ...           8 years ago
  • 1.14.1                                ...           8 years ago
  • 1.14.0                                ...           8 years ago
  • 1.13.2                                ...           8 years ago
  • 1.13.1                                ...           8 years ago
  • 1.13.0                                ...           8 years ago
  • 1.12.0                                ...           8 years ago
  • 1.11.1                                ...           8 years ago
  • 1.11.0                                ...           8 years ago
  • 1.10.0                                ...           8 years ago
  • 1.9.2                                ...           9 years ago
  • 1.9.1                                ...           9 years ago
  • 1.9.0                                ...           9 years ago
  • 1.8.0                                ...           9 years ago
  • 1.7.0                                ...           9 years ago
  • 1.6.0                                ...           9 years ago
  • 1.5.0                                ...           9 years ago
  • 1.4.0                                ...           9 years ago
  • 1.3.0                                ...           9 years ago
  • 1.2.0                                ...           9 years ago
  • 1.1.0                                ...           9 years ago
  • 1.0.0                                ...           9 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (6)
Dev Dependencies (22)
Dependents (1)

Copyright 2013 - present © cnpmjs.org | Home |