eslint-plugin-react-hooks
Advanced tools
Comparing version
{ | ||
"name": "eslint-plugin-react-hooks", | ||
"description": "ESLint rules for React Hooks", | ||
"version": "5.2.0-canary-f0edf41e-20250115", | ||
"version": "5.2.0-canary-f457d0b4-20250313", | ||
"repository": { | ||
@@ -13,4 +13,5 @@ "type": "git", | ||
"README.md", | ||
"cjs", | ||
"index.js", | ||
"cjs" | ||
"index.d.ts" | ||
], | ||
@@ -23,2 +24,7 @@ "keywords": [ | ||
], | ||
"scripts": { | ||
"build:compiler": "cd ../../compiler && yarn workspace babel-plugin-react-compiler build", | ||
"test": "yarn build:compiler && jest", | ||
"typecheck": "tsc --noEmit" | ||
}, | ||
"license": "MIT", | ||
@@ -28,4 +34,6 @@ "bugs": { | ||
}, | ||
"main": "./index.js", | ||
"types": "./index.d.ts", | ||
"engines": { | ||
"node": ">=10" | ||
"node": ">=18" | ||
}, | ||
@@ -36,4 +44,15 @@ "homepage": "https://react.dev/", | ||
}, | ||
"dependencies": { | ||
"@babel/core": "^7.24.4", | ||
"@babel/parser": "^7.24.4", | ||
"@babel/plugin-transform-private-methods": "^7.24.4", | ||
"hermes-parser": "^0.25.1", | ||
"zod": "^3.22.4", | ||
"zod-validation-error": "^3.0.3" | ||
}, | ||
"devDependencies": { | ||
"@babel/eslint-parser": "^7.11.4", | ||
"@babel/preset-typescript": "^7.26.0", | ||
"@babel/types": "^7.19.0", | ||
"@tsconfig/strictest": "^2.0.5", | ||
"@typescript-eslint/parser-v2": "npm:@typescript-eslint/parser@^2.26.0", | ||
@@ -43,6 +62,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-v8": "npm:eslint@^8.57.1", | ||
"eslint-v9": "npm:eslint@^9.0.0", | ||
"jest": "^29.5.0", | ||
"typescript": "^5.4.3" | ||
} | ||
} |
@@ -21,8 +21,40 @@ # `eslint-plugin-react-hooks` | ||
Then extend the recommended eslint config: | ||
### Flat Config (eslint.config.js|ts) | ||
#### 5.2.0 | ||
For users of 5.2.0 (the first version with flat config support), add the `recommended-latest` config. | ||
```js | ||
import * as reactHooks from 'eslint-plugin-react-hooks'; | ||
export default [ | ||
// ... | ||
reactHooks.configs['recommended-latest'], | ||
]; | ||
``` | ||
### Legacy Config (.eslintrc) | ||
#### >= 5.2.0 | ||
If you are still using ESLint below 9.0.0, you can use `recommended-legacy` for accessing a legacy version of the recommended config. | ||
```js | ||
{ | ||
"extends": [ | ||
// ... | ||
"plugin:react-hooks/recommended-legacy" | ||
] | ||
} | ||
``` | ||
#### < 5.2.0 | ||
If you're using a version earlier than 5.2.0, the legacy config was simply `recommended`. | ||
```js | ||
{ | ||
"extends": [ | ||
// ... | ||
"plugin:react-hooks/recommended" | ||
@@ -37,3 +69,22 @@ ] | ||
#### Flat Config (eslint.config.js|ts) | ||
```js | ||
import * as 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', | ||
} | ||
}, | ||
]; | ||
``` | ||
#### Legacy Config (.eslintrc) | ||
```js | ||
{ | ||
@@ -52,3 +103,2 @@ "plugins": [ | ||
## Advanced Configuration | ||
@@ -61,6 +111,6 @@ | ||
{ | ||
"rules": { | ||
rules: { | ||
// ... | ||
"react-hooks/exhaustive-deps": ["warn", { | ||
"additionalHooks": "(useMyCustomHook|useMyOtherCustomHook)" | ||
additionalHooks: "(useMyCustomHook|useMyOtherCustomHook)" | ||
}] | ||
@@ -67,0 +117,0 @@ } |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
4866814
2749.29%8
33.33%145350
3515.67%126
65.79%7
600%18
125%1
Infinity%+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
- Removed
- Removed