From d3f0e005ca1b218d7f6455aee3ecf4927b5d2787 Mon Sep 17 00:00:00 2001 From: Lauren Tan Date: Thu, 28 Aug 2025 18:19:21 -0400 Subject: [PATCH] [eprh] Update installation instructions in readme Small PR to update our readme for eslint-plugin-react-hooks, to better describe what a minimal but complete eslint config would look like. --- packages/eslint-plugin-react-hooks/README.md | 35 ++++++++++++++------ 1 file changed, 24 insertions(+), 11 deletions(-) diff --git a/packages/eslint-plugin-react-hooks/README.md b/packages/eslint-plugin-react-hooks/README.md index 10020afd61038..20d32fe9fd1bc 100644 --- a/packages/eslint-plugin-react-hooks/README.md +++ b/packages/eslint-plugin-react-hooks/README.md @@ -22,15 +22,22 @@ yarn add eslint-plugin-react-hooks --dev #### >= 6.0.0 -For users of 6.0 and beyond, simply add the `recommended` config. +For users of 6.0 and beyond, add the `recommended` config. ```js -import * as reactHooks from 'eslint-plugin-react-hooks'; +// eslint.config.js +import reactHooks from 'eslint-plugin-react-hooks'; +import { defineConfig } from 'eslint/config'; -export default [ - // ... - reactHooks.configs.recommended, -]; +export default defineConfig([ + { + files: ["src/**/*.{js,jsx,ts,tsx}"], + plugins: { + 'react-hooks': reactHooks, + }, + extends: ['react-hooks/recommended'], + }, +]); ``` #### 5.2.0 @@ -38,12 +45,18 @@ export default [ 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'; +import reactHooks from 'eslint-plugin-react-hooks'; +import { defineConfig } from 'eslint/config'; -export default [ - // ... - reactHooks.configs['recommended-latest'], -]; +export default defineConfig([ + { + files: ["src/**/*.{js,jsx,ts,tsx}"], + plugins: { + 'react-hooks': reactHooks, + }, + extends: ['react-hooks/recommended-latest'], + }, +]); ``` ### Legacy Config (.eslintrc)