Compare commits

...

1 Commits

Author SHA1 Message Date
Mofei Zhang
df3c78b4d2 [eprh] Add back a deprecated no-op for removed component-hook-factories rule
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.
2026-04-17 12:21:21 -04:00
2 changed files with 17 additions and 2 deletions

View File

@@ -74,7 +74,6 @@ export default [
// React Compiler rules
'react-hooks/config': 'error',
'react-hooks/error-boundaries': 'error',
'react-hooks/component-hook-factories': 'error',
'react-hooks/gating': 'error',
'react-hooks/globals': 'error',
'react-hooks/immutability': 'error',
@@ -108,7 +107,6 @@ export default [
// React Compiler rules
"react-hooks/config": "error",
"react-hooks/error-boundaries": "error",
"react-hooks/component-hook-factories": "error",
"react-hooks/gating": "error",
"react-hooks/globals": "error",
"react-hooks/immutability": "error",

View File

@@ -15,12 +15,29 @@ import {
} from './shared/ReactCompiler';
import RulesOfHooks from './rules/RulesOfHooks';
function makeDeprecatedRule(version: string): Rule.RuleModule {
return {
meta: {
type: 'suggestion',
docs: {
description: `Deprecated: this rule has been removed in ${version}.`,
},
schema: [],
deprecated: true,
},
create() {
return {};
},
};
}
const rules = {
'exhaustive-deps': ExhaustiveDeps,
'rules-of-hooks': RulesOfHooks,
...Object.fromEntries(
Object.entries(allRules).map(([name, config]) => [name, config.rule]),
),
'component-hook-factories': makeDeprecatedRule('7.1.0'),
} satisfies Record<string, Rule.RuleModule>;
const basicRuleConfigs = {