Skip to content

Automated Testing: Enforce dependencies checks consistently for development files#79703

Merged
aduth merged 1 commit into
trunkfrom
remove/eslint-import-exemptions-dev-files
Jun 30, 2026
Merged

Automated Testing: Enforce dependencies checks consistently for development files#79703
aduth merged 1 commit into
trunkfrom
remove/eslint-import-exemptions-dev-files

Conversation

@aduth

@aduth aduth commented Jun 30, 2026

Copy link
Copy Markdown
Member

What?

Updates ESLint configuration to enforce import rules consistently, regardless of "development files" status.

Related:

Why?

The reason we have import/no-extraneous-dependencies is to ensure packages declare their dependencies. There's nothing special about development files that they should be exempt from this rule.

Based on my findings outlined at #79320 (comment), my assumption is that this largely originated as a combination of (a) temporarily ignoring failing files that were deemed "less critical" and (b) limitations of the default ESLint import resolver described in #72136 which have since been resolved.

How?

  • Removes the exemption for import/no-extraneous-dependencies applying to development files.
  • Fixes existing issues by defining missing dependencies.

#76195 will also be helpful here for ensuring isolated dependencies, but as long as we continue using import/no-extraneous-dependencies, we should be consistent in how it applies to files. The exemptions don't make sense.

Separately, I plan to iterate to remove more of these "development file" exemptions, which seems possible but they have their own unique issues to work through. This initial sweep keeps the diff reasonable.

Testing Instructions

npm run lint:js should pass.

Use of AI Tools

Manually revised lint rule changes. Used Cursor IDE + Composer model to add missing package.json dependencies based on failure report. Reviewed changes manually for consistency, and edited manually in some cases to reduce size of diff (e.g. manually downgrading @typescript-eslint/parser to avoid a nested copy).

@github-actions

Copy link
Copy Markdown

Warning: Type of PR label mismatch

To merge this PR, it requires exactly 1 label indicating the type of PR. Other labels are optional and not being checked here.

  • Required label: Any label starting with [Type].
  • Labels found: .

Read more about Type labels in Gutenberg. Don't worry if you don't have the required permissions to add labels; the PR reviewer should be able to help with the task.

1 similar comment
@github-actions

Copy link
Copy Markdown

Warning: Type of PR label mismatch

To merge this PR, it requires exactly 1 label indicating the type of PR. Other labels are optional and not being checked here.

  • Required label: Any label starting with [Type].
  • Labels found: .

Read more about Type labels in Gutenberg. Don't worry if you don't have the required permissions to add labels; the PR reviewer should be able to help with the task.

@github-actions github-actions Bot added [Package] Core data /packages/core-data [Package] Block editor /packages/block-editor [Package] Media Utils /packages/media-utils labels Jun 30, 2026
@github-actions

github-actions Bot commented Jun 30, 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: aduth <aduth@git.wordpress.org>
Co-authored-by: manzoorwanijk <manzoorwanijk@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.61 MB

compressed-size-action

@aduth aduth added the [Type] Automated Testing Testing infrastructure changes impacting the execution of end-to-end (E2E) and/or unit tests. label Jun 30, 2026
@github-actions

Copy link
Copy Markdown

Flaky tests detected in fb769d0.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/28459005545
📝 Reported issues:

@manzoorwanijk manzoorwanijk 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.

This works great. Thank you.

@manzoorwanijk

manzoorwanijk commented Jun 30, 2026

Copy link
Copy Markdown
Member

TIL that require.resolve is not considered for such imports.

There is an open issue for it - import-js/eslint-plugin-import#585

eslint-plugin-n seems to support it.

@manzoorwanijk

Copy link
Copy Markdown
Member

Created an upstream PR to add support for require.resolve - import-js/eslint-plugin-import#3264.

We can enable it in a follow-up when/if that PR lands.

@aduth aduth merged commit 301c30e into trunk Jun 30, 2026
47 of 52 checks passed
@aduth aduth deleted the remove/eslint-import-exemptions-dev-files branch June 30, 2026 19:26
@github-actions github-actions Bot added this to the Gutenberg 23.6 milestone Jun 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Package] Block editor /packages/block-editor [Package] Core data /packages/core-data [Package] Media Utils /packages/media-utils [Type] Automated Testing Testing infrastructure changes impacting the execution of end-to-end (E2E) and/or unit tests.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants