Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sarbbottam/eslint-find-rules
Find built-in ESLint rules you don't have in your custom config
https://github.com/sarbbottam/eslint-find-rules
Last synced: 1 day ago
JSON representation
Find built-in ESLint rules you don't have in your custom config
- Host: GitHub
- URL: https://github.com/sarbbottam/eslint-find-rules
- Owner: sarbbottam
- License: mit
- Created: 2016-03-17T17:05:02.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2024-10-11T09:44:13.000Z (28 days ago)
- Last Synced: 2024-10-30T03:35:36.392Z (9 days ago)
- Language: JavaScript
- Homepage: http://npm.im/eslint-find-rules
- Size: 287 KB
- Stars: 206
- Watchers: 5
- Forks: 36
- Open Issues: 15
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
- awesome-eslint - eslint-find-rules - Find built-in ESLint rules you don't have in your custom config. (Tools / Testing Tools)
README
# eslint-find-rules
[![Join the chat at https://gitter.im/sarbbottam/eslint-find-rules](https://badges.gitter.im/sarbbottam/eslint-find-rules.svg)](https://gitter.im/sarbbottam/eslint-find-rules?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
Use this for your own [ESLint](http://eslint.org/) [shareable configuration](http://eslint.org/docs/developer-guide/shareable-configs)
to list current configured rules, all-available rules, unused rules, and plugin rules.[![Build Status](https://img.shields.io/travis/sarbbottam/eslint-find-rules.svg?style=flat-square)](https://travis-ci.org/sarbbottam/eslint-find-rules)
[![Code Coverage](https://img.shields.io/codecov/c/github/sarbbottam/eslint-find-rules.svg?style=flat-square)](https://codecov.io/github/sarbbottam/eslint-find-rules)
[![version](https://img.shields.io/npm/v/eslint-find-rules.svg?style=flat-square)](http://npm.im/eslint-find-rules)
[![downloads](https://img.shields.io/npm/dm/eslint-find-rules.svg?style=flat-square)](http://npm-stat.com/charts.html?package=eslint-find-rules&from=2015-08-01)
[![MIT License](https://img.shields.io/npm/l/eslint-find-rules.svg?style=flat-square)](http://opensource.org/licenses/MIT)
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](http://makeapullrequest.com)
[![All Contributors](https://img.shields.io/badge/all_contributors-10-orange.svg?style=flat-square)](#contributors)## Acknowledgment
This module is an extended version of [eslint-find-new-rules](https://github.com/kentcdodds/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:
```javascript
{
...
"scripts": {
"eslint-find-option-rules": "eslint-find-rules [option] [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, --ext .js, and --flatConfig
```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).
By default, ESLint will handle configs in Legacy mode. If you want to handle Flat config files, you need to add the `--flatConfig` flag.
**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](https://github.com/kentcdodds/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](http://eslint.org/docs/user-guide/configuring).
### 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 `require`d 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 documentationruleFinder.getCurrentRules()
ruleFinder.getCurrentRulesDetailed()
ruleFinder.getPluginRules()
ruleFinder.getAllAvailableRules()
ruleFinder.getUnusedRules()
ruleFinder.getDeprecatedRules()
```### Log the difference between two config files
```javascript
{
...
"scripts": {
"eslint-diff-rules": "eslint-diff-rules "
}
...
}
```## Contributors
Thanks goes to these wonderful people ([emoji key](https://github.com/kentcdodds/all-contributors#emoji-key)):
| [
Sarbbottam Bandyopadhyay](https://twitter.com/sarbbottam)
[π»](https://github.com/sarbbottam/eslint-find-rules/commits?author=sarbbottam "Code") [π](https://github.com/sarbbottam/eslint-find-rules/commits?author=sarbbottam "Documentation") [β οΈ](https://github.com/sarbbottam/eslint-find-rules/commits?author=sarbbottam "Tests") [π](#review-sarbbottam "Reviewed Pull Requests") | [
Andreas Windt](https://twitter.com/ta2edchimp)
[π»](https://github.com/sarbbottam/eslint-find-rules/commits?author=ta2edchimp "Code") [π](https://github.com/sarbbottam/eslint-find-rules/commits?author=ta2edchimp "Documentation") [β οΈ](https://github.com/sarbbottam/eslint-find-rules/commits?author=ta2edchimp "Tests") [π](#review-ta2edchimp "Reviewed Pull Requests") | [
Kent C. Dodds](https://twitter.com/kentcdodds)
[π»](https://github.com/sarbbottam/eslint-find-rules/commits?author=kentcdodds "Code") [π](https://github.com/sarbbottam/eslint-find-rules/commits?author=kentcdodds "Documentation") [β οΈ](https://github.com/sarbbottam/eslint-find-rules/commits?author=kentcdodds "Tests") [π](#review-kentcdodds "Reviewed Pull Requests") | [
Scott Nonnenberg](https://github.com/scottnonnenberg)
[π»](https://github.com/sarbbottam/eslint-find-rules/commits?author=scottnonnenberg "Code") [β οΈ](https://github.com/sarbbottam/eslint-find-rules/commits?author=scottnonnenberg "Tests") | [
MichaΕ GoΕΔbiowski](https://github.com/mgol)
[π»](https://github.com/sarbbottam/eslint-find-rules/commits?author=mgol "Code") | [
Jeroen Engels](https://github.com/jfmengels)
[π](https://github.com/sarbbottam/eslint-find-rules/commits?author=jfmengels "Documentation") | [
Dustin Specker](https://github.com/dustinspecker)
[π»](https://github.com/sarbbottam/eslint-find-rules/commits?author=dustinspecker "Code") |
| :---: | :---: | :---: | :---: | :---: | :---: | :---: |
| [
Randy Coulman](https://github.com/randycoulman)
[π»](https://github.com/sarbbottam/eslint-find-rules/commits?author=randycoulman "Code") [β οΈ](https://github.com/sarbbottam/eslint-find-rules/commits?author=randycoulman "Tests") | [
Jordan Harband](https://twitter.com/ljharb)
[π](https://github.com/sarbbottam/eslint-find-rules/commits?author=ljharb "Documentation") [π](https://github.com/sarbbottam/eslint-find-rules/issues?q=author%3Aljharb "Bug reports") [π»](https://github.com/sarbbottam/eslint-find-rules/commits?author=ljharb "Code") [π¬](#question-ljharb "Answering Questions") [π](#review-ljharb "Reviewed Pull Requests") [β οΈ](https://github.com/sarbbottam/eslint-find-rules/commits?author=ljharb "Tests") [π](#infra-ljharb "Infrastructure (Hosting, Build-Tools, etc)") | [
Brad Zacher](https://zacher.com.au)
[π»](https://github.com/sarbbottam/eslint-find-rules/commits?author=bradzacher "Code") [β οΈ](https://github.com/sarbbottam/eslint-find-rules/commits?author=bradzacher "Tests") |This project follows the [all-contributors](https://github.com/kentcdodds/all-contributors) specification.
Contributions of any kind welcome!Special thanks to [@mgol](https://github.com/mgol) who created the original script.
## LICENSE
MIT