Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/wagerfield/eslint-index
CLI for finding and managing rules in ESLint config files
https://github.com/wagerfield/eslint-index
Last synced: about 2 months ago
JSON representation
CLI for finding and managing rules in ESLint config files
- Host: GitHub
- URL: https://github.com/wagerfield/eslint-index
- Owner: wagerfield
- License: mit
- Created: 2016-11-10T05:00:58.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2021-08-10T22:50:28.000Z (over 3 years ago)
- Last Synced: 2024-08-11T11:58:23.720Z (5 months ago)
- Language: JavaScript
- Homepage:
- Size: 4.31 MB
- Stars: 20
- Watchers: 3
- Forks: 4
- Open Issues: 8
-
Metadata Files:
- Readme: readme.md
- License: license
Awesome Lists containing this project
- awesome-eslint - eslint-index - CLI for finding and managing rules in ESLint config files. (Tools / Testing Tools)
README
# ![ESLint][eslint-logo] ESLint Index
> CLI for finding and managing rules in ESLint config files
List all the rules!
![Demo 1][demo-1]
Then count them, or create a pretty table!
![Demo 2][demo-2]
## Installation
```bash
npm install eslint-index --save-dev
```## Usage
```bash
eslint-index path/to/.eslintrc [options]
```This package is intended to be used as a _local_ utility.
It needs both `eslint` and the `eslint-plugins` referenced in the `.eslintrc.*` config file, to be installed alongside it.
Using it as a _global_ utility will throw an error if `eslint` and the `eslint-plugins` referenced in the `.eslintrc.*` config file are not installed globally.
It is recommended that you use it within your `package.json` scripts:
```
"scripts": {
"list-rules": "eslint-index .eslintrc",
"count-rules": "eslint-index .eslintrc --format number",
"table-rules": "eslint-index .eslintrc --format table",
"list-rules-with-docs": "eslint-index .eslintrc --docs",
"list-eslint-rules": "eslint-index .eslintrc --groups eslint",
"list-disabled-rules": "eslint-index .eslintrc --status omitted off"
}
```Alternatively, you can add `./node_modules/.bin` to your `$PATH`.
This will allow you to use any node binaries within your project:
```
» cd some-project-with-eslint-index-installed
» which eslint-index
./node_modules/.bin/eslint-index
» eslint-index .eslintrc --format table
┌──────────┬─────────┬─────────┬─────────┬─────────┬─────────┐
│ │ total │ omitted │ off │ warn │ error │
├──────────┼─────────┼─────────┼─────────┼─────────┼─────────┤
│ eslint │ 233 │ 0 │ 29 │ 2 │ 202 │
├──────────┼─────────┼─────────┼─────────┼─────────┼─────────┤
│ react │ 53 │ 4 │ 0 │ 0 │ 49 │
└──────────┴─────────┴─────────┴─────────┴─────────┴─────────┘
```## Options
Option | Alias | Description | Arg Type | Arg Options
------------|-------|------------------------------|-----------------|------------
`--help` | `-h` | Display help | `Boolean` | `N/A`
`--docs` | `-d` | Display docs alongside rules | `Boolean` | `N/A`
`--format` | `-f` | Format rules | `String` | `list|table|number`
`--status` | `-s` | Filter rules by status | `Array` | `omitted|off|warn|error`
`--groups` | `-g` | Filter rules by group/plugin | `Array` | `eslint|plugin eg. react`
`--include` | `-i` | Filter rules by id | `Array` | `rule-id-one rule-id-two`
`--exclude` | `-e` | Reject rules by id | `Array` | `rule-id-one rule-id-two`## Examples
```bash
eslint-index .eslintrc --format table
eslint-index .eslintrc --format number
eslint-index .eslintrc --status omitted off
eslint-index .eslintrc --status warn error
eslint-index .eslintrc --groups eslint react
eslint-index .eslintrc --groups eslint --status warn error
eslint-index .eslintrc --groups eslint --status warn error --format number
eslint-index .eslintrc --include semi curly
eslint-index .eslintrc --exclude semi curly
eslint-index .eslintrc --docs
eslint-index .eslintrc --groups eslint react --docs
```## Author
Matthew Wagerfield [@wagerfield](http://twitter.com/wagerfield)
[eslint-logo]: assets/eslint-logo.png
[demo-1]: assets/demo-1.gif
[demo-2]: assets/demo-2.gif