eslint-plugin-react-hooks
Advanced tools
Comparing version 5.2.0-canary-130095f7-20241212 to 5.2.0-canary-18eaf51b-20250118
{ | ||
"name": "eslint-plugin-react-hooks", | ||
"description": "ESLint rules for React Hooks", | ||
"version": "5.2.0-canary-130095f7-20241212", | ||
"version": "5.2.0-canary-18eaf51b-20250118", | ||
"repository": { | ||
@@ -38,3 +38,3 @@ "type": "git", | ||
"@typescript-eslint/parser-v4": "npm:@typescript-eslint/parser@^4.1.0", | ||
"@typescript-eslint/parser-v5": "npm:@typescript-eslint/parser@^5.0.0-0", | ||
"@typescript-eslint/parser-v5": "npm:@typescript-eslint/parser@^5.62.0", | ||
"babel-eslint": "^10.0.3", | ||
@@ -41,0 +41,0 @@ "eslint-v7": "npm:eslint@^7.7.0", |
@@ -21,4 +21,6 @@ # `eslint-plugin-react-hooks` | ||
Then extend the recommended eslint config: | ||
### Legacy Config (.eslintrc) | ||
If you are still using ESLint below 9.0.0, please continue to use `recommended-legacy`. To avoid breaking changes, we still support `recommended` as well, but note that this will be changed to alias the flat recommended config in v6. | ||
```js | ||
@@ -28,3 +30,3 @@ { | ||
// ... | ||
"plugin:react-hooks/recommended" | ||
"plugin:react-hooks/recommended-legacy" | ||
] | ||
@@ -34,2 +36,15 @@ } | ||
### Flat Config (eslint.config.js) | ||
For [ESLint 9.0.0 and above](https://eslint.org/blog/2024/04/eslint-v9.0.0-released/) users, add the `recommended-latest` config. | ||
```js | ||
import reactHooks from 'eslint-plugin-react-hooks'; | ||
export default [ | ||
// ... | ||
reactHooks.configs['recommended-latest'], | ||
]; | ||
``` | ||
### Custom Configuration | ||
@@ -39,2 +54,4 @@ | ||
#### Legacy Config (.eslintrc) | ||
```js | ||
@@ -54,3 +71,20 @@ { | ||
#### Flat Config (eslint.config.js) | ||
```js | ||
import reactHooks from 'eslint-plugin-react-hooks'; | ||
export default [ | ||
{ | ||
files: ['**/*.{js,jsx}'], | ||
plugins: { 'react-hooks': reactHooks }, | ||
// ... | ||
rules: { | ||
'react-hooks/rules-of-hooks': 'error', | ||
'react-hooks/exhaustive-deps': 'warn', | ||
} | ||
}, | ||
]; | ||
``` | ||
## Advanced Configuration | ||
@@ -57,0 +91,0 @@ |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
180170
4112
110