https://github.com/stevensacks/eslint-plugin-sort-react-dependency-arrays
ESLint plugin to alphabetically sort React hook dependency arrays
https://github.com/stevensacks/eslint-plugin-sort-react-dependency-arrays
Last synced: 7 months ago
JSON representation
ESLint plugin to alphabetically sort React hook dependency arrays
- Host: GitHub
- URL: https://github.com/stevensacks/eslint-plugin-sort-react-dependency-arrays
- Owner: stevensacks
- License: mit
- Created: 2022-08-03T08:19:09.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2024-07-17T17:51:50.000Z (about 2 years ago)
- Last Synced: 2025-03-06T10:58:37.041Z (over 1 year ago)
- Language: JavaScript
- Size: 128 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# eslint-plugin-sort-react-dependency-arrays
ESLint plugin to enforce alphanumerically sorted React hook dependency arrays.
Works with --fix.
## Installation
You'll first need to install [ESLint](https://eslint.org/):
```sh
npm i eslint --save-dev
```
Next, install `eslint-plugin-sort-react-dependency-arrays`:
```sh
npm install eslint-plugin-sort-react-dependency-arrays --save-dev
```
## Usage
Add `sort-react-dependency-arrays` to the plugins section of your `.eslintrc` configuration file. You can omit the `eslint-plugin-` prefix:
```json
{
"plugins": [
"sort-react-dependency-arrays"
]
}
```
Then enable the rule under the rules section.
```json
{
"rules": {
"sort-react-dependency-arrays/sort": "error"
}
}
```