From 443b7ff2a8437f7736491ae7136c21d75d5a2019 Mon Sep 17 00:00:00 2001 From: michael faith Date: Mon, 3 Mar 2025 19:57:05 -0600 Subject: [PATCH] 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 --- packages/eslint-plugin-react-hooks/README.md | 23 +++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/packages/eslint-plugin-react-hooks/README.md b/packages/eslint-plugin-react-hooks/README.md index e4223c18b20e0..138cff733be6b 100644 --- a/packages/eslint-plugin-react-hooks/README.md +++ b/packages/eslint-plugin-react-hooks/README.md @@ -20,20 +20,24 @@ yarn add eslint-plugin-react-hooks --dev ### Flat Config (eslint.config.js|ts) -For [ESLint 9.0.0 and above](https://eslint.org/blog/2024/04/eslint-v9.0.0-released/), add the `recommended` config. +#### 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'], + reactHooks.configs['recommended-latest'], ]; ``` ### Legacy Config (.eslintrc) -If you are still using ESLint below 9.0.0, you can use `recommended-legacy` for accessing the recommended config. +#### >= 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 { @@ -44,6 +48,19 @@ If you are still using ESLint below 9.0.0, you can use `recommended-legacy` for } ``` +#### < 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" + ] +} +``` + ### Custom Configuration If you want more fine-grained configuration, you can instead add a snippet like this to your ESLint configuration file: