[eprh] Update installation instructions in readme (#34331)
Small PR to update our readme for eslint-plugin-react-hooks, to better describe what a minimal but complete eslint config would look like.
lauren committed
Aug 28, 2025 at 18:27 UTC
872b4fef6ded18aa9bda5f7729340384a914ba7b
1 file changed
+24
-11
packages/eslint-plugin-react-hooks/README.md
+24
-11
@@ -22,15 +22,22 @@ yarn add eslint-plugin-react-hooks --dev
22
23
#### >= 6.0.0
24
25
-For users of 6.0 and beyond, simply add the `recommended` config.
25
+For users of 6.0 and beyond, add the `recommended` config.
26
27
```js
28
-import * as reactHooks from 'eslint-plugin-react-hooks';
28
+// eslint.config.js
29
+import reactHooks from 'eslint-plugin-react-hooks';
30
+import { defineConfig } from 'eslint/config';
31
30
-export default [
31
- // ...
32
- reactHooks.configs.recommended,
33
-];
32
+export default defineConfig([
33
+ {
34
+ files: ["src/**/*.{js,jsx,ts,tsx}"],
35
+ plugins: {
36
+ 'react-hooks': reactHooks,
37
+ },
38
+ extends: ['react-hooks/recommended'],
39
+ },
40
+]);
41
```
42
43
#### 5.2.0
@@ -38,12 +45,18 @@ export default [
45
For users of 5.2.0 (the first version with flat config support), add the `recommended-latest` config.
46
47
```js
41
-import * as reactHooks from 'eslint-plugin-react-hooks';
48
+import reactHooks from 'eslint-plugin-react-hooks';
49
+import { defineConfig } from 'eslint/config';
50
43
-export default [
44
- // ...
45
- reactHooks.configs['recommended-latest'],
46
-];
51
+export default defineConfig([
52
+ {
53
+ files: ["src/**/*.{js,jsx,ts,tsx}"],
54
+ plugins: {
55
+ 'react-hooks': reactHooks,
56
+ },
57
+ extends: ['react-hooks/recommended-latest'],
58
+ },
59
+]);
60
```
61
62
### Legacy Config (.eslintrc)