From d55cc79bcf5cd3bd4cb406381b067d72842f368e Mon Sep 17 00:00:00 2001 From: michael faith Date: Fri, 28 Feb 2025 10:12:10 -0600 Subject: [PATCH] refactor(eslint-plugin-react-hooks): move rules to `rules` folder (#32411) Since the compiler plugin is going to be merged into the hooks plugin, and ultimately decomposed into several more rules, it would be good to start creating a more traditional folder structure for the plugin. This change just moves the rules into a `rules` folder. Co-authored-by: lauren --- packages/eslint-plugin-react-hooks/README.md | 4 ++-- packages/eslint-plugin-react-hooks/src/index.ts | 4 ++-- .../src/{ => rules}/ExhaustiveDeps.ts | 0 .../eslint-plugin-react-hooks/src/{ => rules}/RulesOfHooks.ts | 0 4 files changed, 4 insertions(+), 4 deletions(-) rename packages/eslint-plugin-react-hooks/src/{ => rules}/ExhaustiveDeps.ts (100%) rename packages/eslint-plugin-react-hooks/src/{ => rules}/RulesOfHooks.ts (100%) diff --git a/packages/eslint-plugin-react-hooks/README.md b/packages/eslint-plugin-react-hooks/README.md index 36f63722f7..cf54caec98 100644 --- a/packages/eslint-plugin-react-hooks/README.md +++ b/packages/eslint-plugin-react-hooks/README.md @@ -36,7 +36,7 @@ If you are still using ESLint below 9.0.0, please continue to use `recommended-l For [ESLint 9.0.0 and above](https://eslint.org/blog/2024/04/eslint-v9.0.0-released/) users, add the `recommended-latest` config. ```js -import reactHooks from 'eslint-plugin-react-hooks'; +import * as reactHooks from 'eslint-plugin-react-hooks'; export default [ // ... @@ -67,7 +67,7 @@ If you want more fine-grained configuration, you can instead add a snippet like #### Flat Config (eslint.config.js) ```js -import reactHooks from 'eslint-plugin-react-hooks'; +import * as reactHooks from 'eslint-plugin-react-hooks'; export default [ { diff --git a/packages/eslint-plugin-react-hooks/src/index.ts b/packages/eslint-plugin-react-hooks/src/index.ts index 42b55320fc..5ddbbcbb80 100644 --- a/packages/eslint-plugin-react-hooks/src/index.ts +++ b/packages/eslint-plugin-react-hooks/src/index.ts @@ -4,8 +4,8 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ -import RulesOfHooks from './RulesOfHooks'; -import ExhaustiveDeps from './ExhaustiveDeps'; +import RulesOfHooks from './rules/RulesOfHooks'; +import ExhaustiveDeps from './rules/ExhaustiveDeps'; import type {ESLint, Linter, Rule} from 'eslint'; // All rules diff --git a/packages/eslint-plugin-react-hooks/src/ExhaustiveDeps.ts b/packages/eslint-plugin-react-hooks/src/rules/ExhaustiveDeps.ts similarity index 100% rename from packages/eslint-plugin-react-hooks/src/ExhaustiveDeps.ts rename to packages/eslint-plugin-react-hooks/src/rules/ExhaustiveDeps.ts diff --git a/packages/eslint-plugin-react-hooks/src/RulesOfHooks.ts b/packages/eslint-plugin-react-hooks/src/rules/RulesOfHooks.ts similarity index 100% rename from packages/eslint-plugin-react-hooks/src/RulesOfHooks.ts rename to packages/eslint-plugin-react-hooks/src/rules/RulesOfHooks.ts