@@ -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
3845For 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