Skip to content

Commit 6525aa1

Browse files
t-hamanoclaude
andcommitted
ESLint: Migrate config and override zod resolution for v7
In v7, the umbrella `react-compiler` rule is split into individual rules; map them via the `recommended-latest` flat config and disable them as a group where the v6 override turned the umbrella off. `chromium-bidi` exact-pins `zod@3.23.8` which gets hoisted, breaking `zod-validation-error` (peer-required by `eslint-plugin-react-hooks`) which needs zod v4. Add an `overrides` entry to force zod@3 → 4.3.6. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 97721f3 commit 6525aa1

3 files changed

Lines changed: 31 additions & 4 deletions

File tree

package-lock.json

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,8 @@
113113
"wait-on": "8.0.1"
114114
},
115115
"overrides": {
116-
"jsdom": "26.1.0"
116+
"jsdom": "26.1.0",
117+
"zod@3": "4.3.6"
117118
},
118119
"scripts": {
119120
"build": "node ./bin/build.mjs",

tools/eslint/config.mjs

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,19 @@ const require = createRequire( import.meta.url );
3030
const rootDir = resolve( import.meta.dirname, '../..' );
3131
const wpPlugin = require( '@wordpress/eslint-plugin' );
3232

33+
// In eslint-plugin-react-hooks v7, the single `react-compiler` rule was split
34+
// into individual rules. Derive the off-mapping from the `recommended-latest`
35+
// preset (excluding the basic hooks rules) so we can disable them as a group.
36+
const reactCompilerRulesOff = Object.fromEntries(
37+
Object.keys( reactHooksPlugin.configs.flat[ 'recommended-latest' ].rules )
38+
.filter(
39+
( name ) =>
40+
name !== 'react-hooks/rules-of-hooks' &&
41+
name !== 'react-hooks/exhaustive-deps'
42+
)
43+
.map( ( name ) => [ name, 'off' ] )
44+
);
45+
3346
/**
3447
* ESLint v10 forbids redefining a plugin under the same key unless the
3548
* reference is strictly identical. Because the @wordpress/eslint-plugin
@@ -220,6 +233,9 @@ export default dedupePlugins( [
220233
// Storybook recommended (array of 3).
221234
...storybookPlugin.configs[ 'flat/recommended' ],
222235

236+
// React Hooks recommended-latest (includes React Compiler rules).
237+
reactHooksPlugin.configs.flat[ 'recommended-latest' ],
238+
223239
// Global settings applicable to all files.
224240
{
225241
languageOptions: {
@@ -283,7 +299,7 @@ export default dedupePlugins( [
283299
definedTags: [ 'jest-environment' ],
284300
},
285301
],
286-
'react-hooks/react-compiler': [
302+
'react-hooks/config': [
287303
'error',
288304
{
289305
environment: {
@@ -339,7 +355,7 @@ export default dedupePlugins( [
339355
'import/no-unresolved': 'off',
340356
'import/named': 'off',
341357
'@wordpress/data-no-store-string-literals': 'off',
342-
'react-hooks/react-compiler': 'off',
358+
...reactCompilerRulesOff,
343359
},
344360
},
345361

@@ -779,7 +795,7 @@ export default dedupePlugins( [
779795
{
780796
files: [ 'packages/interactivity*/src/**' ],
781797
rules: {
782-
'react-hooks/react-compiler': 'off',
798+
...reactCompilerRulesOff,
783799
'react/react-in-jsx-scope': 'error',
784800
},
785801
},

0 commit comments

Comments
 (0)