Skip to content

Commit eb8c620

Browse files
committed
[eprh] Update plugin config to be compatible with flat and legacy (#34762)
This has been incredibly frustrating as [ESLint's own docs](https://eslint.org/docs/latest/extend/plugins#backwards-compatibility-for-legacy-configs) are clearly wrong (see #34679). This PR uses [eslint-plugin-react's setup](https://github.com/jsx-eslint/eslint-plugin-react/blob/master/index.js) as a reference, where the presets are assigned to `configs.flat` (not documented by eslint). DiffTrain build for [848e0e3](848e0e3)
1 parent 9a48776 commit eb8c620

35 files changed

+128
-116
lines changed

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

Lines changed: 42 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -57754,46 +57754,58 @@ const compilerRuleConfigs = Object.fromEntries(Object.entries(recommendedRules).
5775457754
];
5775557755
}));
5775657756
const allRuleConfigs = Object.assign(Object.assign({}, basicRuleConfigs), compilerRuleConfigs);
57757+
const plugins = ['react-hooks'];
57758+
const configs = {
57759+
'recommended-legacy': {
57760+
plugins,
57761+
rules: basicRuleConfigs,
57762+
},
57763+
'recommended-latest-legacy': {
57764+
plugins,
57765+
rules: allRuleConfigs,
57766+
},
57767+
'flat/recommended': {
57768+
plugins,
57769+
rules: basicRuleConfigs,
57770+
},
57771+
'recommended-latest': {
57772+
plugins,
57773+
rules: allRuleConfigs,
57774+
},
57775+
recommended: {
57776+
plugins,
57777+
rules: basicRuleConfigs,
57778+
},
57779+
flat: {},
57780+
};
5775757781
const plugin = {
5775857782
meta: {
5775957783
name: 'eslint-plugin-react-hooks',
5776057784
},
5776157785
rules,
57762-
configs: {},
57786+
configs,
5776357787
};
57764-
Object.assign(plugin.configs, {
57788+
Object.assign(configs.flat, {
5776557789
'recommended-legacy': {
57766-
plugins: ['react-hooks'],
57767-
rules: basicRuleConfigs,
57790+
plugins: { 'react-hooks': plugin },
57791+
rules: configs['recommended-legacy'].rules,
5776857792
},
5776957793
'recommended-latest-legacy': {
57770-
plugins: ['react-hooks'],
57771-
rules: allRuleConfigs,
57794+
plugins: { 'react-hooks': plugin },
57795+
rules: configs['recommended-latest-legacy'].rules,
57796+
},
57797+
'flat/recommended': {
57798+
plugins: { 'react-hooks': plugin },
57799+
rules: configs['flat/recommended'].rules,
57800+
},
57801+
'recommended-latest': {
57802+
plugins: { 'react-hooks': plugin },
57803+
rules: configs['recommended-latest'].rules,
57804+
},
57805+
recommended: {
57806+
plugins: { 'react-hooks': plugin },
57807+
rules: configs.recommended.rules,
5777257808
},
57773-
'flat/recommended': [
57774-
{
57775-
plugins: {
57776-
'react-hooks': plugin,
57777-
},
57778-
rules: basicRuleConfigs,
57779-
},
57780-
],
57781-
'recommended-latest': [
57782-
{
57783-
plugins: {
57784-
'react-hooks': plugin,
57785-
},
57786-
rules: allRuleConfigs,
57787-
},
57788-
],
57789-
recommended: [
57790-
{
57791-
plugins: {
57792-
'react-hooks': plugin,
57793-
},
57794-
rules: basicRuleConfigs,
57795-
},
57796-
],
5779757809
});
5779857810

5779957811
module.exports = plugin;

compiled/facebook-www/REVISION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
a4eb2dfa6fec3da5a947eb84c99b059890bb5241
1+
848e0e3a4f12022d396ddbc2b52fd8fa7ac31fa9
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
a4eb2dfa6fec3da5a947eb84c99b059890bb5241
1+
848e0e3a4f12022d396ddbc2b52fd8fa7ac31fa9

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1460,7 +1460,7 @@ __DEV__ &&
14601460
exports.useTransition = function () {
14611461
return resolveDispatcher().useTransition();
14621462
};
1463-
exports.version = "19.3.0-www-classic-a4eb2dfa-20251006";
1463+
exports.version = "19.3.0-www-classic-848e0e3a-20251007";
14641464
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
14651465
"function" ===
14661466
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
@@ -1460,7 +1460,7 @@ __DEV__ &&
14601460
exports.useTransition = function () {
14611461
return resolveDispatcher().useTransition();
14621462
};
1463-
exports.version = "19.3.0-www-modern-a4eb2dfa-20251006";
1463+
exports.version = "19.3.0-www-modern-848e0e3a-20251007";
14641464
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
14651465
"function" ===
14661466
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
@@ -606,4 +606,4 @@ exports.useSyncExternalStore = function (
606606
exports.useTransition = function () {
607607
return ReactSharedInternals.H.useTransition();
608608
};
609-
exports.version = "19.3.0-www-classic-a4eb2dfa-20251006";
609+
exports.version = "19.3.0-www-classic-848e0e3a-20251007";

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -606,4 +606,4 @@ exports.useSyncExternalStore = function (
606606
exports.useTransition = function () {
607607
return ReactSharedInternals.H.useTransition();
608608
};
609-
exports.version = "19.3.0-www-modern-a4eb2dfa-20251006";
609+
exports.version = "19.3.0-www-modern-848e0e3a-20251007";

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -610,7 +610,7 @@ exports.useSyncExternalStore = function (
610610
exports.useTransition = function () {
611611
return ReactSharedInternals.H.useTransition();
612612
};
613-
exports.version = "19.3.0-www-classic-a4eb2dfa-20251006";
613+
exports.version = "19.3.0-www-classic-848e0e3a-20251007";
614614
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
615615
"function" ===
616616
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -610,7 +610,7 @@ exports.useSyncExternalStore = function (
610610
exports.useTransition = function () {
611611
return ReactSharedInternals.H.useTransition();
612612
};
613-
exports.version = "19.3.0-www-modern-a4eb2dfa-20251006";
613+
exports.version = "19.3.0-www-modern-848e0e3a-20251007";
614614
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
615615
"function" ===
616616
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20348,10 +20348,10 @@ __DEV__ &&
2034820348
(function () {
2034920349
var internals = {
2035020350
bundleType: 1,
20351-
version: "19.3.0-www-classic-a4eb2dfa-20251006",
20351+
version: "19.3.0-www-classic-848e0e3a-20251007",
2035220352
rendererPackageName: "react-art",
2035320353
currentDispatcherRef: ReactSharedInternals,
20354-
reconcilerVersion: "19.3.0-www-classic-a4eb2dfa-20251006"
20354+
reconcilerVersion: "19.3.0-www-classic-848e0e3a-20251007"
2035520355
};
2035620356
internals.overrideHookState = overrideHookState;
2035720357
internals.overrideHookStateDeletePath = overrideHookStateDeletePath;
@@ -20386,7 +20386,7 @@ __DEV__ &&
2038620386
exports.Shape = Shape;
2038720387
exports.Surface = Surface;
2038820388
exports.Text = Text;
20389-
exports.version = "19.3.0-www-classic-a4eb2dfa-20251006";
20389+
exports.version = "19.3.0-www-classic-848e0e3a-20251007";
2039020390
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
2039120391
"function" ===
2039220392
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&

0 commit comments

Comments
 (0)