Skip to content

Commit 872b4fe

Browse files
authored
[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.
1 parent c5362a3 commit 872b4fe

File tree

1 file changed

+24
-11
lines changed

1 file changed

+24
-11
lines changed

packages/eslint-plugin-react-hooks/README.md

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,28 +22,41 @@ yarn add eslint-plugin-react-hooks --dev
2222

2323
#### >= 6.0.0
2424

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.
2626

2727
```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';
2931

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+
]);
3441
```
3542

3643
#### 5.2.0
3744

3845
For users of 5.2.0 (the first version with flat config support), add the `recommended-latest` config.
3946

4047
```js
41-
import * as reactHooks from 'eslint-plugin-react-hooks';
48+
import reactHooks from 'eslint-plugin-react-hooks';
49+
import { defineConfig } from 'eslint/config';
4250

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+
]);
4760
```
4861

4962
### Legacy Config (.eslintrc)

0 commit comments

Comments
 (0)