eslint-plugin-react-hooks
Advanced tools
Comparing version 5.2.0-canary-b3a95caf-20250113 to 5.2.0-canary-bb9a24d9-20250130
{ | ||
"name": "eslint-plugin-react-hooks", | ||
"description": "ESLint rules for React Hooks", | ||
"version": "5.2.0-canary-b3a95caf-20250113", | ||
"version": "5.2.0-canary-bb9a24d9-20250130", | ||
"repository": { | ||
@@ -6,0 +6,0 @@ "type": "git", |
@@ -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