Skip to content

Fix ESLint plugin dependencies#368

Open
mariozenmedina wants to merge 1 commit into
10up:developfrom
mariozenmedina:fix/eslint-dependencies
Open

Fix ESLint plugin dependencies#368
mariozenmedina wants to merge 1 commit into
10up:developfrom
mariozenmedina:fix/eslint-dependencies

Conversation

@mariozenmedina

Copy link
Copy Markdown

Description of the Change

Draft for maintainer feedback: this PR focuses only on fixing ESLint dependency resolution so wp-scripts lint-js can load the project configs. It does not attempt to fix the existing lint violations that are surfaced afterward.

The root .eslintrc extends plugin:@wordpress/eslint-plugin/recommended, but @wordpress/eslint-plugin was only available as a nested dependency of @wordpress/scripts. Because ESLint resolves plugins from the project config location, it could not find the WordPress ESLint plugin from the project root.

There is a similar issue for Cypress linting: tests/cypress/.eslintrc extends plugin:cypress/recommended, but eslint-plugin-cypress was not declared as a project dependency.

After making those plugins resolvable, ESLint also reaches the WordPress config's TypeScript import resolver setup. The newer resolver interface is not compatible with this project's current ESLint 8 / eslint-plugin-import stack, causing:

Resolve error: typescript with invalid interface loaded as resolver

This PR pins eslint-import-resolver-typescript to 3.5.5, which is compatible with the current ESLint stack.

After this change, wp-scripts lint-js loads the configs/plugins successfully and reaches the existing lint violations, mostly CRLF/Prettier-related formatting errors, which are outside the scope of this PR.

Closes #352

How to test the Change

Using Node 20, matching .nvmrc:

  1. Run npm ci.
  2. Run npx wp-scripts lint-js.

Expected result:

  • ESLint should no longer fail with missing plugin errors for @wordpress/eslint-plugin or eslint-plugin-cypress.
  • ESLint should no longer fail with Resolve error: typescript with invalid interface loaded as resolver.
  • The command may still report existing lint violations, such as CRLF/Prettier formatting errors, which are outside the scope of this PR.

I also validated config loading with:

  • ./node_modules/.bin/eslint --print-config assets/js/blocks.js
  • ./node_modules/.bin/eslint --print-config tests/cypress/support/index.js

Changelog Entry

Fixed - ESLint plugin dependency resolution for WordPress and Cypress lint configs.

Credits

Props @mariozenmedina

Checklist:

Documentation and new tests were not added because this is a development dependency/configuration fix. Existing linting still reports pre-existing formatting issues after the dependency resolution problem is fixed.

@jeffpaul jeffpaul requested a review from peterwilsoncc July 2, 2026 14:51
@jeffpaul jeffpaul added this to the 2.0.0 milestone Jul 2, 2026
@peterwilsoncc peterwilsoncc modified the milestones: 2.0.0, 2.1.0 Jul 2, 2026
@mariozenmedina mariozenmedina marked this pull request as ready for review July 5, 2026 03:31
@mariozenmedina mariozenmedina requested a review from a team as a code owner July 5, 2026 03:31
@mariozenmedina

Copy link
Copy Markdown
Author

I accidentally clicked "Ready for review" while this PR was originally opened as a draft for maintainer feedback. I’ll leave it ready for now to avoid extra status noise, but the intended scope is still the same: this only fixes ESLint dependency/config resolution and does not address the existing lint violations. Feedback on whether this is the right direction is very welcome.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix eslint config

3 participants