Skip to content

build(deps-dev): migrate to ESLint 10 and flat config - #702

Merged
dcalhoun merged 4 commits into
build/bump-wordpress-packagesfrom
build/upgrade-eslint
Sep 21, 2026
Merged

dcalhoun merged 4 commits into
build/bump-wordpress-packagesfrom
build/upgrade-eslint

Conversation

@dcalhoun

@dcalhoun dcalhoun commented Sep 18, 2026

Copy link
Copy Markdown
Member

What?

Update to ESLint 10 now that Gutenberg core's packages support it.

Why?

Keep up-to-date with Gutenberg and other dependencies.

How?

  • Address lint errors
  • Bump relevant dependencies
  • Remove Dependabot configuration excluding ESLint version bumps
  • Add nuance to agent instructions regarding lint tooling

Testing Instructions

N/A, no user-facing changes.

Accessibility Testing Instructions

N/A, no user-facing changes.

Screenshots or screencast

N/A, no user-facing changes.


Agent summary

WordPress/gutenberg#64782 is closed — @wordpress/eslint-plugin supports ESLint 9 and 10 as of 25.0.0, which also dropped eslintrc. The ESLint 8 pin had frozen the WordPress ruleset two majors back at 24.3.0 (no plugin bump since March 2026).

Toolchain: eslint 8.57 → 10.10, @wordpress/eslint-plugin 24.3 → 26.0, eslint-plugin-react-refresh 0.4 → 0.5, globals added. Matches Gutenberg, which runs ESLint 10.

Config: .eslintrc.cjs, e2e/.eslintrc.cjs, and .eslintignore become eslint.config.js. Three details are deliberate:

  • The node import/resolver is carried over. Without it, import/no-unresolved fails on the patched @wordpress/block-editor subpaths (extensionless exports targets) and on @wordpress/preferences-persistence (its types condition names unpublished build output).
  • test-playwright skips e2e/**/*.test.js. eslint-plugin-playwright goes 0.15 → 2.x, whose rules read vitest it() blocks as stray assertions — 17 errors in e2e/fetch-json.test.js otherwise.
  • .build/ is ignored explicitly. Flat config does not skip dot directories, so ESLint otherwise walks the 1.5 GB SwiftPM output.

Peer range: eslint-plugin-import@2.32.0 still caps at ESLint 9, so its eslint peer is overridden to the root version — narrower than the repo-wide legacy-peer-deps Gutenberg uses.

Code changes: 9 unused catch bindings (ESLint 9 flipped no-unused-vars caughtErrors to "all") and 2 forwardRef components renamed to Gutenberg's Unforwarded* convention (ESLint 10 no-shadow flags a named function expression shadowing its own binding).

Why stacked on #691: plugin 26 depends on @wordpress/theme 2.x, whose modern subtree makes npm dedupe 10 in-range production @wordpress/* packages upward. On trunk that is unwanted drift in a lint PR; on #691 those packages already sit at exactly those versions, so the lock diff stays confined to the lint subtree.

Verified: make lint-js clean (112 files linted vs. 110 before — gains .prettierrc.cjs and the config itself, none dropped), 231 unit tests pass, check:wp-packages passes. E2E not run.

Follow-up: the @typescript-eslint/typescript-estreeminimatch 9.0.9 override is now a forced major downgrade (typescript-estree 8 declares ^10.2.2) with no corresponding advisory. npm will not drop the lock entry without hand-editing it, so it is left for a separate PR.

🤖 Generated with Claude Code

@github-actions github-actions Bot added the [Type] Build Tooling Issues or PRs related to build tooling label Sep 18, 2026
@dcalhoun
dcalhoun added this pull request to stack #703 September 18, 2026 20:20
@wpmobilebot

wpmobilebot commented Sep 18, 2026

Copy link
Copy Markdown

XCFramework Build

This PR's XCFramework is available for testing. Add the following to your Package.swift:

.package(url: "https://github.com/wordpress-mobile/GutenbergKit", branch: "pr-build/702")

Built from dc2ecef

Comment thread package.json
Comment on lines +146 to +147
"eslint-plugin-import": {
"eslint": "$eslint"

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The latest eslint-plugin-import release declares a peer of eslint@^9. This overrides the peer to match the root eslint version.

@dcalhoun
dcalhoun marked this pull request as ready for review September 18, 2026 20:34
@dcalhoun
dcalhoun requested a review from a team as a code owner September 18, 2026 20:35
@dcalhoun
dcalhoun requested a review from adalpari September 18, 2026 20:35
@dcalhoun dcalhoun changed the title build: migrate to ESLint 10 and flat config build(deps-dev): migrate to ESLint 10 and flat config Sep 18, 2026

@adalpari adalpari left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

dcalhoun and others added 4 commits September 21, 2026 13:48
ESLint 9 changes the `no-unused-vars` default for `caughtErrors` from
"none" to "all", which flags these bindings. None are read, so use the
optional catch binding instead.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
ESLint 10's `no-shadow` reports a named function expression whose name
shadows the binding it is assigned to. Adopt Gutenberg's convention for
`forwardRef` components, which keeps a useful name in React DevTools.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
`@wordpress/eslint-plugin` 25.0.0 dropped eslintrc and raised its peer to
ESLint 9 or 10, so the ESLint 8 pin had quietly frozen the WordPress
ruleset two majors back at 24.3.0. Gutenberg itself now runs ESLint 10,
and with the pin gone the Dependabot ignores it justified go too.

`eslint-plugin-import` has not widened its peer range past ESLint 9, so
its `eslint` peer is overridden to the root version. That is narrower
than the repo-wide `legacy-peer-deps` Gutenberg relies on.

Flat config does not ignore dot directories the way eslintrc did, so
`.build/` is named explicitly to keep ESLint out of the SwiftPM output.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Name the config file agents should open, and record that the Playwright
ruleset deliberately skips `e2e/**/*.test.js` so a future widening of the
glob does not pull vitest tests back under rules that reject them.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@dcalhoun
dcalhoun force-pushed the build/upgrade-eslint branch from 7f4087d to dc2ecef Compare September 21, 2026 17:49
@dcalhoun
dcalhoun merged commit 4fabef3 into trunk Sep 21, 2026
24 checks passed
@dcalhoun
dcalhoun deleted the build/upgrade-eslint branch September 21, 2026 18:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Type] Build Tooling Issues or PRs related to build tooling

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants