Skip to content

Commit 03117b3

Browse files
committed
[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. DiffTrain build for [bc24980](bc24980)
1 parent f86449d commit 03117b3

37 files changed

Lines changed: 134 additions & 89 deletions

compiled/eslint-plugin-react-hooks/index.js

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55444,7 +55444,22 @@ function last(array) {
5544455444
return array[array.length - 1];
5544555445
}
5544655446

55447-
const rules = Object.assign({ 'exhaustive-deps': rule$1, 'rules-of-hooks': rule }, Object.fromEntries(Object.entries(allRules).map(([name, config]) => [name, config.rule])));
55447+
function makeDeprecatedRule(version) {
55448+
return {
55449+
meta: {
55450+
type: 'suggestion',
55451+
docs: {
55452+
description: `Deprecated: this rule has been removed in ${version}.`,
55453+
},
55454+
schema: [],
55455+
deprecated: true,
55456+
},
55457+
create() {
55458+
return {};
55459+
},
55460+
};
55461+
}
55462+
const rules = Object.assign(Object.assign({ 'exhaustive-deps': rule$1, 'rules-of-hooks': rule }, Object.fromEntries(Object.entries(allRules).map(([name, config]) => [name, config.rule]))), { 'component-hook-factories': makeDeprecatedRule('7.1.0') });
5544855463
const basicRuleConfigs = {
5544955464
'react-hooks/rules-of-hooks': 'error',
5545055465
'react-hooks/exhaustive-deps': 'warn',

compiled/facebook-www/ESLintPluginReactHooks-dev.classic.js

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55396,7 +55396,22 @@ function last(array) {
5539655396
return array[array.length - 1];
5539755397
}
5539855398

55399-
const rules = Object.assign({ 'exhaustive-deps': rule$1, 'rules-of-hooks': rule }, Object.fromEntries(Object.entries(allRules).map(([name, config]) => [name, config.rule])));
55399+
function makeDeprecatedRule(version) {
55400+
return {
55401+
meta: {
55402+
type: 'suggestion',
55403+
docs: {
55404+
description: `Deprecated: this rule has been removed in ${version}.`,
55405+
},
55406+
schema: [],
55407+
deprecated: true,
55408+
},
55409+
create() {
55410+
return {};
55411+
},
55412+
};
55413+
}
55414+
const rules = Object.assign(Object.assign({ 'exhaustive-deps': rule$1, 'rules-of-hooks': rule }, Object.fromEntries(Object.entries(allRules).map(([name, config]) => [name, config.rule]))), { 'component-hook-factories': makeDeprecatedRule('7.1.0') });
5540055415
const basicRuleConfigs = {
5540155416
'react-hooks/rules-of-hooks': 'error',
5540255417
'react-hooks/exhaustive-deps': 'warn',

compiled/facebook-www/ESLintPluginReactHooks-dev.modern.js

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55444,7 +55444,22 @@ function last(array) {
5544455444
return array[array.length - 1];
5544555445
}
5544655446

55447-
const rules = Object.assign({ 'exhaustive-deps': rule$1, 'rules-of-hooks': rule }, Object.fromEntries(Object.entries(allRules).map(([name, config]) => [name, config.rule])));
55447+
function makeDeprecatedRule(version) {
55448+
return {
55449+
meta: {
55450+
type: 'suggestion',
55451+
docs: {
55452+
description: `Deprecated: this rule has been removed in ${version}.`,
55453+
},
55454+
schema: [],
55455+
deprecated: true,
55456+
},
55457+
create() {
55458+
return {};
55459+
},
55460+
};
55461+
}
55462+
const rules = Object.assign(Object.assign({ 'exhaustive-deps': rule$1, 'rules-of-hooks': rule }, Object.fromEntries(Object.entries(allRules).map(([name, config]) => [name, config.rule]))), { 'component-hook-factories': makeDeprecatedRule('7.1.0') });
5544855463
const basicRuleConfigs = {
5544955464
'react-hooks/rules-of-hooks': 'error',
5545055465
'react-hooks/exhaustive-deps': 'warn',

compiled/facebook-www/REVISION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
da9325b519376e2d65cdf6d509ade053e14ec5b3
1+
bc249804d3c2ea6ee95bc5543c3735a65d1239b5
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
da9325b519376e2d65cdf6d509ade053e14ec5b3
1+
bc249804d3c2ea6ee95bc5543c3735a65d1239b5

compiled/facebook-www/React-dev.classic.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1482,7 +1482,7 @@ __DEV__ &&
14821482
exports.useTransition = function () {
14831483
return resolveDispatcher().useTransition();
14841484
};
1485-
exports.version = "19.3.0-www-classic-da9325b5-20260417";
1485+
exports.version = "19.3.0-www-classic-bc249804-20260417";
14861486
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
14871487
"function" ===
14881488
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&

compiled/facebook-www/React-dev.modern.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1482,7 +1482,7 @@ __DEV__ &&
14821482
exports.useTransition = function () {
14831483
return resolveDispatcher().useTransition();
14841484
};
1485-
exports.version = "19.3.0-www-modern-da9325b5-20260417";
1485+
exports.version = "19.3.0-www-modern-bc249804-20260417";
14861486
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
14871487
"function" ===
14881488
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&

compiled/facebook-www/React-prod.classic.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -610,4 +610,4 @@ exports.useSyncExternalStore = function (
610610
exports.useTransition = function () {
611611
return ReactSharedInternals.H.useTransition();
612612
};
613-
exports.version = "19.3.0-www-classic-da9325b5-20260417";
613+
exports.version = "19.3.0-www-classic-bc249804-20260417";

compiled/facebook-www/React-prod.modern.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -610,4 +610,4 @@ exports.useSyncExternalStore = function (
610610
exports.useTransition = function () {
611611
return ReactSharedInternals.H.useTransition();
612612
};
613-
exports.version = "19.3.0-www-modern-da9325b5-20260417";
613+
exports.version = "19.3.0-www-modern-bc249804-20260417";

compiled/facebook-www/React-profiling.classic.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -614,7 +614,7 @@ exports.useSyncExternalStore = function (
614614
exports.useTransition = function () {
615615
return ReactSharedInternals.H.useTransition();
616616
};
617-
exports.version = "19.3.0-www-classic-da9325b5-20260417";
617+
exports.version = "19.3.0-www-classic-bc249804-20260417";
618618
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
619619
"function" ===
620620
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&

0 commit comments

Comments
 (0)