[eprh] Add back a no-op for removed component-hook-factories rule (#36307)
The `component-hook-factories` rule was removed in #35825 as part of a feature flag cleanup, but was listed in the README as part of the manual config example. This broke users who used a manual config (copied from the old README) in eslint-plugin-react-hooks 7.1.0. This adds back a deprecated no-op rule as a fix. #35825 removed other rules (`automatic-effect-dependencies` and `fire`), but these were for experimental features that did not ship. These were also not referenced in the README.
mofeiZ committed
Apr 17, 2026 at 12:31 UTC
bc249804d3c2ea6ee95bc5543c3735a65d1239b5
2 files changed
+17
-2
packages/eslint-plugin-react-hooks/README.md
-2
@@ -74,7 +74,6 @@ export default [
74
// React Compiler rules
75
'react-hooks/config': 'error',
76
'react-hooks/error-boundaries': 'error',
77
- 'react-hooks/component-hook-factories': 'error',
77
'react-hooks/gating': 'error',
78
'react-hooks/globals': 'error',
79
'react-hooks/immutability': 'error',
@@ -108,7 +107,6 @@ export default [
107
// React Compiler rules
108
"react-hooks/config": "error",
109
"react-hooks/error-boundaries": "error",
111
- "react-hooks/component-hook-factories": "error",
110
"react-hooks/gating": "error",
111
"react-hooks/globals": "error",
112
"react-hooks/immutability": "error",
packages/eslint-plugin-react-hooks/src/index.ts
+17
@@ -15,12 +15,29 @@ import {
15
} from './shared/ReactCompiler';
16
import RulesOfHooks from './rules/RulesOfHooks';
17
18
+function makeDeprecatedRule(version: string): Rule.RuleModule {
19
+ return {
20
+ meta: {
21
+ type: 'suggestion',
22
+ docs: {
23
+ description: `Deprecated: this rule has been removed in ${version}.`,
24
+ },
25
+ schema: [],
26
+ deprecated: true,
27
+ },
28
+ create() {
29
+ return {};
30
+ },
31
+ };
32
+}
33
+
34
const rules = {
35
'exhaustive-deps': ExhaustiveDeps,
36
'rules-of-hooks': RulesOfHooks,
37
...Object.fromEntries(
38
Object.entries(allRules).map(([name, config]) => [name, config.rule]),
39
),
40
+ 'component-hook-factories': makeDeprecatedRule('7.1.0'),
41
} satisfies Record<string, Rule.RuleModule>;
42
43
const basicRuleConfigs = {