Skip to content

ESLint: Drop @eslint/compat fixup for jest-dom and testing-library - #80842

Merged
manzoorwanijk merged 1 commit into
trunkfrom
update/eslint-plugins-drop-compat-fixup
Jul 29, 2026
Merged

ESLint: Drop @eslint/compat fixup for jest-dom and testing-library#80842
manzoorwanijk merged 1 commit into
trunkfrom
update/eslint-plugins-drop-compat-fixup

Conversation

@manzoorwanijk

Copy link
Copy Markdown
Member

What?

Follow up to #76654.

Updates eslint-plugin-jest-dom and eslint-plugin-testing-library to versions that support ESLint v10, and drops the fixupPluginRules compat wrapper for both. Also bumps eslint-plugin-import to 2.32.0.

Why?

The @eslint/compat wrappers added during the ESLint v10 migration were meant to be temporary. Both eslint-plugin-jest-dom and eslint-plugin-testing-library now declare eslint ^10 support, so the shim is dead weight there.

How?

Probed every rule of all four wrapped plugins against ESLint 10.6.0 with the fixup removed, to check which ones actually still break:

Plugin Result Action
eslint-plugin-jest-dom all 11 rules OK fixup removed, ^5.5.0^5.6.0
eslint-plugin-testing-library all 29 rules OK fixup removed, ^7.16.0^7.16.2
eslint-plugin-react 6 rules still throw fixup kept, no newer version available
eslint-plugin-import 3 rules still throw fixup kept, ^2.31.0^2.32.0

eslint-plugin-react 7.37.5 (latest) still calls context.getFilename(), context.getSourceCode() and sourceCode.isSpaceBetweenTokens(), breaking jsx-filename-extension, jsx-curly-spacing, jsx-equals-spacing, jsx-tag-spacing, jsx-one-expression-per-line and forward-ref-uses-ref. Four of those are enabled in this repo, so the fixup stays.

eslint-plugin-import 2.32.0 still reads the removed context.parserOptions in no-default-export, no-named-export and unambiguouslib/core/sourceType.js is byte-identical between 2.31.0 and 2.32.0, so the bump doesn't help. The fixup stays.

@eslint/compat is therefore removed from tools/eslint but kept in packages/eslint-plugin, where configs/react.js and configs/recommended-with-formatting.js still need it.

In tools/eslint/config.mjs the explicit plugins: { ... } overrides on the jest-dom and testing-library entries are also gone: they only existed to inject the wrapped plugin, and each config already registers its own plugin.

Testing Instructions

  1. npm install
  2. npm run lint:js — passes with no errors.
  3. Confirm the rules are still active and reporting:
    npx eslint --print-config packages/components/src/button/test/index.tsx
    
    should list the 11 jest-dom/* and 22 testing-library/* rules.

Verified locally: full npm run lint:js reports 0 errors, and the 456 warnings are all pre-existing playwright/*, react-hooks/exhaustive-deps and jest/expect-expect. A scratch test file with deliberate violations correctly triggered jest-dom/prefer-enabled-disabled, jest-dom/prefer-in-document and testing-library/prefer-presence-queries.

Testing Instructions for Keyboard

N/A — tooling only.

Use of AI Tools

Authored with Claude Code; the plugin compatibility probing and the resulting changes were reviewed and verified locally.

Both plugins now declare ESLint v10 support, so the fixupPluginRules
wrapper added during the v10 migration is no longer needed.

eslint-plugin-react and eslint-plugin-import still call context APIs
removed in v10, so their fixups stay.
@manzoorwanijk manzoorwanijk added the [Type] Code Quality Issues or PRs that relate to code quality label Jul 29, 2026
@manzoorwanijk manzoorwanijk self-assigned this Jul 29, 2026
@manzoorwanijk
manzoorwanijk marked this pull request as ready for review July 29, 2026 11:30
@github-actions

github-actions Bot commented Jul 29, 2026

Copy link
Copy Markdown

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: manzoorwanijk <manzoorwanijk@git.wordpress.org>
Co-authored-by: Mamaduka <mamaduka@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@github-actions

Copy link
Copy Markdown

Size Change: 0 B

Total Size: 7.76 MB

compressed-size-action

@Mamaduka Mamaduka left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks good ✅

@manzoorwanijk
manzoorwanijk merged commit c4004cf into trunk Jul 29, 2026
58 checks passed
@manzoorwanijk
manzoorwanijk deleted the update/eslint-plugins-drop-compat-fixup branch July 29, 2026 12:30
@github-actions github-actions Bot added this to the Gutenberg 23.8 milestone Jul 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Type] Code Quality Issues or PRs that relate to code quality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Sponsor
SponsoredKunjungi sekarang
Promo