eslint-plugin-react-hooks
Advanced tools
Comparing version 5.2.0-canary-056073de-20250109 to 5.2.0-canary-0a82580b-20250203
{ | ||
"name": "eslint-plugin-react-hooks", | ||
"description": "ESLint rules for React Hooks", | ||
"version": "5.2.0-canary-056073de-20250109", | ||
"version": "5.2.0-canary-0a82580b-20250203", | ||
"repository": { | ||
@@ -35,2 +35,3 @@ "type": "git", | ||
"@babel/eslint-parser": "^7.11.4", | ||
"@tsconfig/strictest": "^2.0.5", | ||
"@typescript-eslint/parser-v2": "npm:@typescript-eslint/parser@^2.26.0", | ||
@@ -40,6 +41,13 @@ "@typescript-eslint/parser-v3": "npm:@typescript-eslint/parser@^3.10.0", | ||
"@typescript-eslint/parser-v5": "npm:@typescript-eslint/parser@^5.62.0", | ||
"@types/eslint": "^8.56.12", | ||
"@types/estree": "^1.0.6", | ||
"@types/estree-jsx": "^1.0.5", | ||
"@types/node": "^20.2.5", | ||
"babel-eslint": "^10.0.3", | ||
"eslint-v7": "npm:eslint@^7.7.0", | ||
"eslint-v9": "npm:eslint@^9.0.0" | ||
"eslint-v9": "npm:eslint@^9.0.0", | ||
"jest": "^29.5.0", | ||
"tsup": "^8.3.5", | ||
"typescript": "^5.4.3" | ||
} | ||
} |
@@ -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
180409
4112
110
16