Skip to content

Commit 443b7ff

Browse files
authored
docs(eslint-plugin-react-hooks): clarify config details for prior versions (#32498)
This change adds more details about prior versions of the plugin's config, to help people as they migrate from legacy to flat configs across multiple versions of this plugin. At some point in the 6.0 or 7.0 cycle, it would probably make sense to re-consolidate this into a single version. Closes #32494
1 parent d4e24b3 commit 443b7ff

File tree

1 file changed

+20
-3
lines changed

1 file changed

+20
-3
lines changed

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

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,20 +20,24 @@ yarn add eslint-plugin-react-hooks --dev
2020

2121
### Flat Config (eslint.config.js|ts)
2222

23-
For [ESLint 9.0.0 and above](https://eslint.org/blog/2024/04/eslint-v9.0.0-released/), add the `recommended` config.
23+
#### 5.2.0
24+
25+
For users of 5.2.0 (the first version with flat config support), add the `recommended-latest` config.
2426

2527
```js
2628
import * as reactHooks from 'eslint-plugin-react-hooks';
2729

2830
export default [
2931
// ...
30-
reactHooks.configs['recommended'],
32+
reactHooks.configs['recommended-latest'],
3133
];
3234
```
3335

3436
### Legacy Config (.eslintrc)
3537

36-
If you are still using ESLint below 9.0.0, you can use `recommended-legacy` for accessing the recommended config.
38+
#### >= 5.2.0
39+
40+
If you are still using ESLint below 9.0.0, you can use `recommended-legacy` for accessing a legacy version of the recommended config.
3741

3842
```js
3943
{
@@ -44,6 +48,19 @@ If you are still using ESLint below 9.0.0, you can use `recommended-legacy` for
4448
}
4549
```
4650

51+
#### < 5.2.0
52+
53+
If you're using a version earlier than 5.2.0, the legacy config was simply `recommended`.
54+
55+
```js
56+
{
57+
"extends": [
58+
// ...
59+
"plugin:react-hooks/recommended"
60+
]
61+
}
62+
```
63+
4764
### Custom Configuration
4865

4966
If you want more fine-grained configuration, you can instead add a snippet like this to your ESLint configuration file:

0 commit comments

Comments
 (0)