Skip to content

ESLint: Replace strict config with bulk suppressions - #81248

Merged
ciampo merged 8 commits into
trunkfrom
codex/81188-bulk-suppress-dependency-import-lint
Aug 7, 2026
Merged

ESLint: Replace strict config with bulk suppressions#81248
ciampo merged 8 commits into
trunkfrom
codex/81188-bulk-suppress-dependency-import-lint

Conversation

@ciampo

@ciampo ciampo commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Follow-up to #81246 and part of #81188.

What?

Applies the repository-wide dependency import cleanup, preserves the remaining exceptions as suppressions, enables the final rules in the base ESLint configuration, and removes the temporary strict configuration.

Why?

#81246 prevents new violations in staged files. This PR completes the migration so the same convention is enforced by the normal repository-wide lint command without breaking existing code.

How?

  • Removes safe dependency comment separators and import blank lines across the repository.
  • Keeps the remaining 62 import/order violations in the ESLint suppression file.
  • Enables @wordpress/dependency-group and import/order in the base configuration.
  • Preserves side-effect import order.
  • Removes the temporary strict configuration and returns lint-staged to the base configuration.
  • Updates generated API documentation and the ESLint documentation.

Testing Instructions

  1. Run npm run test:unit -- packages/eslint-plugin/rules/__tests__/dependency-group.js --runInBand.
  2. Run npm run lint:js -- --format compact --quiet --prune-suppressions.
  3. Run npm run docs:api-ref.
  4. Run npm run lint:pkg-json.
  5. Run npm run lint:md:docs -- docs/contributors/folder-structure.md tools/eslint/README.md.

Testing Instructions for Keyboard

Not applicable. This PR has no user interface changes.

TODO / Follow-ups

A later migration step can resolve the 62 suppressed import/order violations.

Use of AI Tools

This PR was authored with Codex.

@github-actions github-actions Bot added [Package] Data /packages/data [Package] A11y /packages/a11y [Package] Autop /packages/autop [Package] Blob /packages/blob [Package] Compose /packages/compose [Package] Core data /packages/core-data [Package] API fetch /packages/api-fetch [Package] Components /packages/components [Package] Blocks /packages/blocks [Package] Block library /packages/block-library [Package] Block editor /packages/block-editor [Package] Data Controls /packages/data-controls [Package] Commands /packages/commands [Package] Core commands /packages/core-commands [Package] DataViews /packages/dataviews labels Aug 5, 2026
@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown

Size Change: +49 B (0%)

Total Size: 7.82 MB

📦 View Changed
Filename Size Change
build/scripts/block-editor/index.min.js 434 kB -1 B (0%)
build/scripts/block-library/index.min.js 356 kB +1 B (0%)
build/scripts/components/index.min.js 278 kB +49 B (+0.02%)

compressed-size-action

@ciampo ciampo self-assigned this Aug 5, 2026
@ciampo ciampo added the [Type] Code Quality Issues or PRs that relate to code quality label Aug 5, 2026
Comment thread .git-blame-ignore-revs Outdated
5d4baa9ab5f57d207cc3a048003216a8574574d9

# Remove dependency import separators.
219f48684dbee5b6e2e2a643ffea046acdaa724b

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.

👍

@manzoorwanijk
manzoorwanijk requested a balanced review from Copilot August 6, 2026 06:35

Copilot AI 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.

Copilot wasn't able to review this pull request because it exceeds the maximum number of files (300). Try reducing the number of changed files and requesting a review from Copilot again.

@ciampo
ciampo force-pushed the codex/81188-define-dependency-import-lint-rules branch from a469b60 to 5a06c73 Compare August 6, 2026 08:23
@ciampo
ciampo force-pushed the codex/81188-bulk-suppress-dependency-import-lint branch from d532a3c to 1302136 Compare August 6, 2026 08:54
@github-actions

github-actions Bot commented Aug 6, 2026

Copy link
Copy Markdown

Flaky tests detected in 1302136.
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/31086848414
📝 Reported issues:

Base automatically changed from codex/81188-define-dependency-import-lint-rules to trunk August 6, 2026 09:32
@ciampo
ciampo requested review from aduth, manzoorwanijk and tyxla August 6, 2026 09:37
@ciampo
ciampo marked this pull request as ready for review August 6, 2026 09:38
@ciampo
ciampo force-pushed the codex/81188-bulk-suppress-dependency-import-lint branch from 5bb7862 to 20fdd7a Compare August 6, 2026 10:21
@ciampo

ciampo commented Aug 6, 2026

Copy link
Copy Markdown
Contributor Author

@manzoorwanijk all feedback addressed. I plan on merging this PR later today, I'll do a last rebase just before merging.

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

Thank you so much for this cleanup! 🚀

@ciampo
ciampo force-pushed the codex/81188-bulk-suppress-dependency-import-lint branch from 20fdd7a to 6d02d6d Compare August 7, 2026 10:59
@ciampo
ciampo enabled auto-merge (squash) August 7, 2026 11:04
@ciampo
ciampo merged commit 7f43eaf into trunk Aug 7, 2026
60 checks passed
@ciampo
ciampo deleted the codex/81188-bulk-suppress-dependency-import-lint branch August 7, 2026 11:34
@github-actions github-actions Bot added this to the Gutenberg 23.8 milestone Aug 7, 2026
amitraj2203 pushed a commit that referenced this pull request Aug 10, 2026
* ESLint: Remove dependency import separators

* ESLint: Replace strict config with suppressions

* ESLint: Update snapshots after import cleanup

* ESLint: Remove dependency import separators after rebase

* ESLint: Activate dependency import rules globally

* ESLint: Address dependency import cleanup feedback

* ESLint: Refresh metadata after final rebase

* ESLint: Finalize dependency import cleanup

---

Co-authored-by: ciampo <mciampini@git.wordpress.org>
Co-authored-by: manzoorwanijk <manzoorwanijk@git.wordpress.org>
Co-authored-by: tyxla <tyxla@git.wordpress.org>
ramonjd added a commit that referenced this pull request Aug 11, 2026
trunk removed the /** WordPress dependencies */ separators repo-wide and
turned on @wordpress/dependency-group and import/order (#81248), so the
import blocks in the files this branch adds no longer pass lint. Remove
the separator comments and the blank lines between import groups.
@sirreal sirreal added the [Package] Views /packages/views label Aug 12, 2026
shail-mehta pushed a commit that referenced this pull request Aug 12, 2026
* ESLint: Remove dependency import separators

* ESLint: Replace strict config with suppressions

* ESLint: Update snapshots after import cleanup

* ESLint: Remove dependency import separators after rebase

* ESLint: Activate dependency import rules globally

* ESLint: Address dependency import cleanup feedback

* ESLint: Refresh metadata after final rebase

* ESLint: Finalize dependency import cleanup

---

Co-authored-by: ciampo <mciampini@git.wordpress.org>
Co-authored-by: manzoorwanijk <manzoorwanijk@git.wordpress.org>
Co-authored-by: tyxla <tyxla@git.wordpress.org>
jasmussen added a commit that referenced this pull request Aug 20, 2026
Trunk removed the dependency grouping comment convention repo-wide in #81248
while this branch was open. The test file added here still carried one, so
`npm run lint:js` failed after merging trunk in.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
ciampo pushed a commit that referenced this pull request Aug 21, 2026
Trunk removed the dependency grouping comment convention repo-wide in #81248
while this branch was open. The test file added here still carried one, so
`npm run lint:js` failed after merging trunk in.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
ciampo pushed a commit that referenced this pull request Aug 21, 2026
Trunk removed the dependency grouping comment convention repo-wide in #81248
while this branch was open. The test file added here still carried one, so
`npm run lint:js` failed after merging trunk in.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
ciampo pushed a commit that referenced this pull request Aug 27, 2026
Trunk removed the dependency grouping comment convention repo-wide in #81248
while this branch was open. The test file added here still carried one, so
`npm run lint:js` failed after merging trunk in.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
ciampo pushed a commit that referenced this pull request Aug 28, 2026
Trunk removed the dependency grouping comment convention repo-wide in #81248
while this branch was open. The test file added here still carried one, so
`npm run lint:js` failed after merging trunk in.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
ciampo pushed a commit that referenced this pull request Aug 28, 2026
Trunk removed the dependency grouping comment convention repo-wide in #81248
while this branch was open. The test file added here still carried one, so
`npm run lint:js` failed after merging trunk in.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
ciampo added a commit that referenced this pull request Aug 28, 2026
* Icons: Redraw 34 prominent icons to strokes

* Update changelog.

* Fix issues with path overrides.

* Fix CI: prettier formatting and item-group snapshots

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

* Update packages/components/CHANGELOG.md

Co-authored-by: Lena Morita <lena@jaguchi.com>

* Update Square, update changelog.

* Update block-icon snapshot for redrawn image icon

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

* Icon: merge consumer style with icon's intrinsic style

Both the components and icons Icon components replaced an icon's intrinsic
style entirely when a consumer passed a style prop, stripping things like
fill: none from stroke-based icons. Merge the two instead, so consumer styles
layer on top and only override on explicit conflicts. Adds regression tests
and corrects the changelog PR links to #78808.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* Icons: normalise redrawn cover icon

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* Icons: harden style-attribute parsing in the build script

The CSS-string to JSX style-object conversion now skips malformed
declarations and escapes values via JSON.stringify, and splits the
declaration list with a tokenizer that ignores semicolons inside
url() and quoted strings (so base64 data: URIs survive). Adds unit
tests covering the splitter and the end-to-end conversion.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* Icon: also merge consumer style in the generic element branch

Apply the same explicit style merge to the isValidElement fallback so a
non-svg icon element's intrinsic style (e.g. fill: none) survives a
consumer-supplied style prop, matching the svg branch. Adds a regression
test, and tidies changelog spacing.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* Icons: allow stroke attributes in registry sanitization

The icon registry sanitizes SVG content through wp_kses with an allowlist
that omitted stroke-related attributes and inline styles. Stroke-based
icons rely on stroke, stroke-width, stroke-linecap, stroke-linejoin,
stroke-miterlimit, vector-effect, and style="fill: none", so server-side
rendering stripped them and the icons rendered as solid black fills.

Add these attributes to the svg and path allowlists in both the compat
base class and the Gutenberg subclass override, so stroke icons render
correctly regardless of which base class core provides.

Co-Authored-By: Claude <noreply@anthropic.com>

* Icons: preserve intrinsic SVG fill style through render

Even with `style` in the kses allowlist, wp_kses filters the attribute
value through safecss_filter_attr(), which drops CSS properties not on its
allowlist. SVG presentation properties like `fill` are not allowed, so
`style="fill: none"` was emptied and removed during sanitization, leaving
stroke-based icons with a solid default fill.

Temporarily register a safe_style_css filter while sanitizing to allow the
SVG presentation properties (fill, stroke, stroke-width, stroke-linecap,
stroke-linejoin, stroke-miterlimit) in both the compat base class and the
Gutenberg subclass override.

Additionally, the icon block overwrote the SVG's intrinsic style attribute
when applying block styles. Merge the existing style with the generated CSS
so `fill: none` survives, with block styles last to win on conflicts.

Co-Authored-By: Claude <noreply@anthropic.com>

* Update lib/class-wp-icons-registry-gutenberg.php

Co-authored-by: Weston Ruter <westonruter@git.wordpress.org>

* Update packages/icons/lib/generate-library.cjs

Co-authored-by: Weston Ruter <westonruter@git.wordpress.org>

* Icons: restore missing JSDoc comment opener in build script

A previous suggestion application landed the JSDoc body without its
opening /** delimiter, which left the file with orphaned * lines that
break Node's parser. Restore the opener so the build runs.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

* Icons: parse style declarations into key/value tuples

Rename splitStyleDeclarations to parseStyleDeclarations and have it
split each declaration on the first un-quoted, un-parenthesised colon
as part of the same tokenisation pass. Returns Array<[key, value]>
instead of string[], so the caller no longer needs a second indexOf
parse to extract the value. Per Weston's review feedback. Adds tests
for the colon-handling edge cases (colons inside parens, quotes, and
`data:` URIs).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

* Icon: address review feedback on icon block and Icon component

- Block icon's render: guard against an empty existing style when
  merging block styles, avoiding a leading semicolon when the
  intrinsic style is absent or whitespace-only.
- Icon component: move the explicit style merge before ...restProps
  in the svg branch to match the generic element branch.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

* Icons: drop type hints from Gutenberg sanitize override

The override declared stricter types than WP_Icons_Registry::sanitize_icon_content()
in the parent class, triggering a PHP signature-compatibility fatal:

  Declaration of WP_Icons_Registry_Gutenberg::sanitize_icon_content(string $icon_content): string
  must be compatible with WP_Icons_Registry::sanitize_icon_content($icon_content)

Match the parent's untyped signature.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

* Icons: drop temporary safe_style_css filter from sanitize_icon_content

The global safe_style_css filter added in #79172
(lib/compat/wordpress-7.1/kses.php) now allowlists SVG presentation
properties, so the per-call filter that temporarily allowed fill/stroke
properties during wp_kses() is redundant.

Co-Authored-By: Claude <noreply@anthropic.com>

* Icons: drop temporary safe_style_css filter from base registry shim

Same cleanup as the previous commit, applied to the WP 7.0 compat base
class. The global safe_style_css filter from #79172 covers the SVG
presentation properties, making the per-call filter redundant here too.

Co-Authored-By: Claude <noreply@anthropic.com>

* Icons: drop safe_style_css comment from base registry shim

Remove the explanatory comment about the global safe_style_css filter
from the WP 7.0 base class for a cleaner sanitize_icon_content().

Co-Authored-By: Claude <noreply@anthropic.com>

* Icon block: Add CSS to preserve stroke-scaling

* Icons: drop dependency group comment from generate-library test

Trunk removed the dependency grouping comment convention repo-wide in #81248
while this branch was open. The test file added here still carried one, so
`npm run lint:js` failed after merging trunk in.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* Icons: Address remaining stroke icon feedback

* BlockVariationPicker: Color stroke icons correctly

* Icon: Normalize merged style prop order

* Icons: Narrow inline style conversion

* Icons: Clarify stroke compatibility

* Icons: Link Core sanitizer backport

* Icons: Remove mismatched Core backport link

* Icons: Preserve stroke icon compatibility after rebase

* Icons: Document recoloring and stroke conventions

* Icons: Address final review feedback

* Icons: Harden inline style conversion

* Icons: Restore Core sanitizer backport link

* Icon block: Add rotation style merge test

* Icon block: Join rotation CSS with a semicolon

* BlockVariationPicker: Restore legacy icon color fallback

* Icons: Preserve clip rules during sanitization

* Icon: Avoid injecting empty style props

---------

Co-authored-by: jasmussen <joen@git.wordpress.org>
Co-authored-by: t-hamano <wildworks@git.wordpress.org>
Co-authored-by: ciampo <mciampini@git.wordpress.org>
Co-authored-by: mirka <0mirka00@git.wordpress.org>
Co-authored-by: westonruter <westonruter@git.wordpress.org>
Co-authored-by: jameskoster <jameskoster@git.wordpress.org>
Co-authored-by: tyxla <tyxla@git.wordpress.org>
Co-authored-by: fcoveram <fcoveram@git.wordpress.org>
Co-authored-by: simison <simison@git.wordpress.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Package] A11y /packages/a11y [Package] API fetch /packages/api-fetch [Package] Autop /packages/autop [Package] Blob /packages/blob [Package] Block editor /packages/block-editor [Package] Block library /packages/block-library [Package] Blocks /packages/blocks [Package] Commands /packages/commands [Package] Components /packages/components [Package] Compose /packages/compose [Package] Core commands /packages/core-commands [Package] Core data /packages/core-data [Package] Data Controls /packages/data-controls [Package] Data /packages/data [Package] DataViews /packages/dataviews [Package] Views /packages/views [Type] Code Quality Issues or PRs that relate to code quality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants