Skip to content

ESLint: Require WCCard alias for legacy Card imports - #85519

Merged
mirka merged 1 commit into
trunkfrom
enforce-card-import-alias
Oct 26, 2026
Merged

mirka merged 1 commit into
trunkfrom
enforce-card-import-alias

Conversation

@mirka

@mirka mirka commented Oct 25, 2026

Copy link
Copy Markdown
Member

What?

Require Card from @wordpress/components to be imported as WCCard.

Why?

Distinguish the legacy component from Card in @wordpress/ui, following the existing naming convention for legacy components.

How?

Add Card: 'WCCard' to the repository's @wordpress/use-import-as configuration and update the six existing consumers to use that alias.

Testing Instructions

  1. In a package source file, add import { Card } from '@wordpress/components'; and confirm the editor's ESLint diagnostic requires the WCCard alias.
  2. Change the import to import { Card as WCCard } from '@wordpress/components'; and confirm the diagnostic clears.
  3. Confirm import { Card } from '@wordpress/ui'; does not produce an import-alias diagnostic.

@mirka mirka added the [Type] Code Quality Issues or PRs that relate to code quality label Oct 25, 2026
@mirka mirka self-assigned this Oct 25, 2026
@github-actions github-actions Bot added the [Package] Preferences /packages/preferences label Oct 25, 2026
@github-actions

github-actions Bot commented Oct 25, 2026 •

Copy link
Copy Markdown

🤖 PR meta 🤖

Preview in WordPress Playground

🎉 Props

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: mirka <0mirka00@git.wordpress.org>
Co-authored-by: aduth <aduth@git.wordpress.org>

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


Props Bot commands

You can trigger Props Bot actions by commenting on this PR:

  • @propsbot add <username> to give props to a GitHub user. Requires write access.
  • @propsbot remove <username> to leave a user out of the props. Requires write access.
  • @propsbot refresh to refresh this list. Adding the props-bot label works too.

Updated as activity occurs, without notifying anyone named here. Add the props-bot label to refresh.

📦 Bundle size

Size Change: 0 B

Total Size: 9.06 MB

34fb365 Run

⚡ Performance

Show the results

Client side metrics exclude the server response time.

front-end-block-theme

Metric 47c69b3 trunk % Change
timeToFirstByte 36.25 ms +15.03% -5.79% 38.05 ms +14.45% -8.02% -4.73%
largestContentfulPaint 64 ms +6.25% -3.13% 68 ms +8.82% -5.88% -5.88%
lcpMinusTtfb 26.55 ms +10.17% -3.2% 29.6 ms +6.42% -14.02% -10.3%
wpBeforeTemplate 19.51 ms +17.12% -7.43% 19.49 ms +26.17% -4.77% 0.1%
wpTemplate 13.72 ms +11.3% -7.36% 14.61 ms +9.99% -9.38% -6.09%
wpTotal 33.18 ms +16.03% -6.09% 35.02 ms +13.71% -8.68% -5.25%
wpMemoryUsage 7.68 MB +0% -0% 7.65 MB +0% -0% 0.42%
wpDbQueries 16 +0% -0% 16 +0% -0% 0%

front-end-classic-theme

Metric 47c69b3 trunk % Change
timeToFirstByte 29.45 ms +9% -3.9% 28.2 ms +11.88% -4.61% 4.43%
largestContentfulPaint 68 ms +5.88% -5.88% 64 ms +6.25% -3.13% 6.25%
lcpMinusTtfb 37.5 ms +9.73% -4.8% 36 ms +2.08% -5.28% 4.17%
wpBeforeTemplate 16.14 ms +8.67% -1.92% 17.2 ms +11.63% -3.49% -6.16%
wpTemplate 10.4 ms +6.44% -5.1% 8.41 ms +6.42% -6.9% 23.66%
wpTotal 26.87 ms +8.78% -3.72% 25.74 ms +12.67% -5.21% 4.39%
wpMemoryUsage 6.37 MB +0% -0% 6.22 MB +0% -0% 2.33%
wpDbQueries 13 +0% -0% 9 +0% -0% 44.44%

media-processing

Metric 47c69b3 trunk % Change
mediaProcessingJpeg 227.95 ms +6.03% -0.7% 229.29 ms +1.59% -0.44% -0.58%
mediaProcessingAvif 3804.86 ms +0.5% -2.96% 3744.8 ms +2.33% -1.21% 1.6%
mediaProcessingJpegToAvif 2697.71 ms +0.57% -0.43% 2590.44 ms +0.85% -3.07% 4.14%

media-upload

Metric 47c69b3 trunk % Change
jpegUploadProcessing 1402.67 ms +1.09% -35.64% 1400.75 ms +1.08% -1.33% 0.14%
pngUploadProcessing 155.02 ms +4.94% -0.95% 171.01 ms +3.13% -3.72% -9.35%
largeJpegUploadProcessing 896.48 ms +0.75% -1.53% 1402.44 ms +0.92% -0.91% -36.08%
multipleImageUploadProcessing 1425.86 ms +1.45% -29.7% 1461.97 ms +0.86% -8.89% -2.47%

post-editor

Metric 47c69b3 trunk % Change
serverResponse 266.39 ms +6.64% -6.27% 265.77 ms +8.74% -1.6% 0.23%
firstPaint 350.01 ms +4.42% -54.82% 245.63 ms +47.75% -29.26% 42.49%
domContentLoaded 772.03 ms +1.36% -1.02% 813.84 ms +1.73% -3.38% -5.14%
loaded 773.16 ms +1.31% -1.03% 815.05 ms +1.69% -3.41% -5.14%
firstContentfulPaint 362.85 ms +1.69% -3.49% 363.9 ms +2.79% -9.98% -0.29%
firstBlock 2169.14 ms +2.17% -0.46% 2273.15 ms +1.59% -2.04% -4.58%
type 13.96 ms +6.02% -3.8% 14.79 ms +2.97% -2.97% -5.61%
typeWithoutInspector 14.75 ms +3.86% -5.56% 14.68 ms +4.29% -1.57% 0.48%
typeWithTopToolbar 17.75 ms +12.73% -4.45% 19.7 ms +4.67% -2.28% -9.9%
typeContainer 6.39 ms +2.19% -6.1% 6.8 ms +4.26% -4.56% -6.03%
focus 80.61 ms +5.72% -6.2% 84.2 ms +3.28% -4.52% -4.26%
firstFocus 155.12 ms +0% -0% 159.45 ms +0% -0% -2.72%
selectAll 360.86 ms +0.5% -2.75% 407.59 ms +4.21% -5.15% -11.46%
listViewOpen 52.85 ms +5.66% -4.3% 54.69 ms +7.62% -10.61% -3.36%
inserterOpen 30.67 ms +5.15% -7.3% 32.03 ms +6.99% -5.15% -4.25%
inserterHover 9.74 ms +6.26% -8.21% 10.31 ms +4.75% -7.76% -5.53%
inserterSearch 7.28 ms +8.1% -7.83% 7.21 ms +4.02% -8.32% 0.97%
loadPatterns 450.79 ms +8.76% -2.32% 479.54 ms +5.64% -0.82% -6%
wpTotal 259.37 ms +6.85% -6.3% 258.82 ms +9.02% -1.6% 0.21%
wpMemoryUsage 14.71 MB +0% -0% 14.68 MB +0% -0% 0.24%
wpDbQueries 55 +0% -0% 55 +0% -0% 0%

site-editor

Metric 47c69b3 trunk % Change
serverResponse 511.61 ms +5.64% -3.6% 487.02 ms +8.98% -1.53% 5.05%
firstPaint 249.96 ms +10.29% -2.01% 257.54 ms +12.79% -10.45% -2.94%
domContentLoaded 1332.92 ms +1.52% -1.89% 1292.91 ms +0.8% -0.51% 3.09%
loaded 1333.9 ms +1.54% -1.88% 1294.26 ms +0.78% -0.55% 3.06%
firstContentfulPaint 493.18 ms +12.52% -14.37% 524.22 ms +2.61% -23.33% -5.92%
firstBlock 4805 ms +0.63% -1.9% 4655.65 ms +0.97% -1.25% 3.21%
type 20.59 ms +3.64% -3.11% 17.81 ms +7.13% -2.13% 15.61%
navigate 118.03 ms +8.69% -0.45% 108.05 ms +18.98% -1.96% 9.24%
loadPatterns 1379.05 ms +4.23% -2.6% 1249.09 ms +14.04% -5.5% 10.4%
loadPages 971.05 ms +4.86% -0.33% 944.74 ms +6.95% -0.45% 2.78%
wpTotal 502.02 ms +5.72% -3.66% 477.59 ms +9.2% -1.62% 5.12%
wpMemoryUsage 12.73 MB +0% -0% 12.70 MB +0% -0% 0.24%
wpDbQueries 44 +2.27% -0% 44 +2.27% -0% 0%

34fb365 Run

🏁 Flaky tests

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.

Custom Completer: should allow newlines after multiple option completions in /test/e2e/specs/editor/various/autocomplete-and-mentions.spec.js, passed after 1 failed attempt.
Error: expect(received).toBe(expected) // Object.is equality

- Expected  - 2
+ Received  + 2

@@ -1,11 +1,11 @@
  <!-- wp:paragraph -->
- <p>🫐 test</p>
+ <p>🍎 test</p>
  <!-- /wp:paragraph -->

  <!-- wp:paragraph -->
- <p>🫐 test</p>
+ <p>~🍎 test</p>
  <!-- /wp:paragraph -->

  <!-- wp:paragraph -->
  <p>🫐 test</p>
  <!-- /wp:paragraph -->

Call Log:
- Timeout 5000ms exceeded while waiting on the predicate
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/various/autocomplete-and-mentions.spec.js:466:6
Custom Completer: should not insert disabled options in /test/e2e/specs/editor/various/autocomplete-and-mentions.spec.js, passed after 1 failed attempt.
Error: expect(received).toBe(expected) // Object.is equality

- Expected  - 1
+ Received  + 1

  <!-- wp:paragraph -->
- <p>Sorry, we are all out of ~g grapes.</p>
+ <p>Sorry, we are all out of 🍎 grapes.</p>
  <!-- /wp:paragraph -->

Call Log:
- Timeout 5000ms exceeded while waiting on the predicate
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/various/autocomplete-and-mentions.spec.js:391:7
Undo restores the post selection when another synced entity is loaded (RTC WebSocket) in /test/e2e/specs/editor/collaboration/collaboration-undo-redo.spec.ts, passed after 1 failed attempt.
Error: expect(received).toMatchObject(expected)

- Expected  - 2
+ Received  + 2

  Object {
    "attributeKey": "content",
    "blockIndex": 0,
    "content": "abcdef",
-   "endOffset": 3,
-   "offset": 3,
+   "endOffset": 1,
+   "offset": 1,
  }

Call Log:
- Timeout 5000ms exceeded while waiting on the predicate
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/collaboration/collaboration-undo-redo.spec.ts:363:5
inserts a block in proper place after having clicked `Browse All` from inline inserter in /test/e2e/specs/editor/various/inserting-blocks.spec.js, passed after 1 failed attempt.
TimeoutError: locator.click: Timeout 10000ms exceeded.
Call log:
  - waiting for getByRole('button', { name: 'Add block' })
    - locator resolved to <button type="button" aria-pressed="false" aria-haspopup="true" aria-expanded="false" aria-label="Add block" class="components-button block-editor-inserter__toggle is-next-40px-default-size has-icon">…</button>
  - attempting click action
    - waiting for element to be visible, enabled and stable
  - element was detached from the DOM, retrying

    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/various/inserting-blocks.spec.js:557:5
is selected with Backspace instead of merged into in /test/e2e/specs/editor/blocks/group.spec.js, passed after 1 failed attempt.
Error: page.evaluate: TypeError: Cannot read properties of undefined (reading 'name')
    at Object.Si [as switchToBlockType] (http://localhost:8891/wp-content/plugins/gutenberg/build/scripts/blocks/index.min.js?ver=299f8ba8f227bd246dad:2:58702)
    at eval (eval at evaluate (:311:30), <anonymous>:4:92)
    at UtilityScript.evaluate (<anonymous>:313:16)
    at UtilityScript.<anonymous> (<anonymous>:1:44)
    at Object.Si (http://localhost:8891/wp-content/plugins/gutenberg/build/scripts/blocks/index.min.js?ver=299f8ba8f227bd246dad:2:58702)
    at eval (eval at evaluate (:311:30), <anonymous>:4:92)
    at UtilityScript.evaluate (<anonymous>:313:16)
    at UtilityScript.<anonymous> (<anonymous>:1:44)
    at Editor.transformBlockTo (/home/runner/work/gutenberg/gutenberg/packages/e2e-test-utils-playwright/src/editor/transform-block-to.ts:14:18)
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/blocks/group.spec.js:85:3
should cut and paste individual blocks with collapsed selection in /test/e2e/specs/editor/various/copy-cut-paste.spec.js, passed after 1 failed attempt.
Error: expect(string).toMatchSnapshot(expected) failed

  @@ -1,3 +1,3 @@
   <!-- wp:paragraph -->
  -<p>2Cut - collapsed selection</p>
  +<p>2</p>
   <!-- /wp:paragraph -->


    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/various/copy-cut-paste.spec.js:45:49
should gradually multi-select in /test/e2e/specs/editor/various/multi-block-selection.spec.js, passed after 1 failed attempt.
Error: expect(received).toMatchObject(expected)

- Expected  - 1
+ Received  + 1

  Array [
    Object {
-     "name": "core/column",
+     "name": "core/paragraph",
    },
  ]

Call Log:
- Timeout 5000ms exceeded while waiting on the predicate
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/various/multi-block-selection.spec.js:1145:5
should indent and outdent level 1 in /test/e2e/specs/editor/blocks/list.spec.js, passed after 1 failed attempt.
TimeoutError: locator.click: Timeout 10000ms exceeded.
Call log:
  - waiting for locator('role=toolbar[name="Block tools"i]').locator('role=button[name="Indent"]')

    at Editor.clickBlockToolbarButton (/home/runner/work/gutenberg/gutenberg/packages/e2e-test-utils-playwright/src/editor/click-block-toolbar-button.ts:17:15)
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/blocks/list.spec.js:775:3
should indent and outdent level 2 in /test/e2e/specs/editor/blocks/list.spec.js, passed after 1 failed attempt.
TimeoutError: locator.click: Timeout 10000ms exceeded.
Call log:
  - waiting for locator('role=toolbar[name="Block tools"i]').locator('role=button[name="Indent"]')
    - locator resolved to <button id="_r_1l_" type="button" tabindex="-1" aria-label="Indent" aria-disabled="true" data-toolbar-item="true" data-truly-disabled="false" aria-describedby="components-button__description-26" class="components-button components-toolbar-button is-compact has-icon">…</button>
  - attempting click action
    2 × waiting for element to be visible, enabled and stable
      - element is not enabled
    - retrying click action
    - waiting 20ms
    2 × waiting for element to be visible, enabled and stable
      - element is not enabled
    - retrying click action
      - waiting 100ms
    18 × waiting for element to be visible, enabled and stable
       - element is not enabled
     - retrying click action
       - waiting 500ms

    at Editor.clickBlockToolbarButton (/home/runner/work/gutenberg/gutenberg/packages/e2e-test-utils-playwright/src/editor/click-block-toolbar-button.ts:17:15)
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/blocks/list.spec.js:933:3
should insert mention in a table block in /test/e2e/specs/editor/various/autocomplete-and-mentions.spec.js, passed after 2 failed attempts.
Error: apiRequestContext.fetch: socket hang up
Call log:
  - → DELETE http://localhost:8891/wp-json/wp/v2/users/27?force=true&reassign=1
    - user-agent: Playwright/1.63.0 (x64; ubuntu 24.04) node/24.20 CI/1
    - accept: */*
    - accept-encoding: gzip,deflate,br
    - X-WP-Nonce: 9366442d25
    - cookie: wordpress_test_cookie=WP%20Cookie%20check; wordpress_logged_in_da433b7faafd8180ebeb1624ceeeab7e=admin%7C1793096959%7C64Hj0aiVk8Vo95eWZhX7U9LbFOaNMZJnL7TBWolr1Mn%7Ceb23b3720200f0443c547ca5b0617ef7b863b63ee7d8fe5143117fccb2b01280; wp-settings-time-1=1792924714

    at RequestUtils.rest (/home/runner/work/gutenberg/gutenberg/packages/e2e-test-utils-playwright/src/request-utils/rest.ts:111:39)
    at RequestUtils.deleteUser (/home/runner/work/gutenberg/gutenberg/packages/e2e-test-utils-playwright/src/request-utils/users.ts:91:30)
    at map (/home/runner/work/gutenberg/gutenberg/packages/e2e-test-utils-playwright/src/request-utils/users.ts:116:51)
    at RequestUtils.deleteAllUsers (/home/runner/work/gutenberg/gutenberg/packages/e2e-test-utils-playwright/src/request-utils/users.ts:116:5)
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/various/autocomplete-and-mentions.spec.js:73:3

should keep a full selection when outdenting nested items with Shift+Tab in /test/e2e/specs/editor/blocks/list.spec.js, passed after 1 failed attempt.
TimeoutError: locator.click: Timeout 10000ms exceeded.
Call log:
  - waiting for locator('role=toolbar[name="Block tools"i]').locator('role=button[name="Indent"]')

    at Editor.clickBlockToolbarButton (/home/runner/work/gutenberg/gutenberg/packages/e2e-test-utils-playwright/src/editor/click-block-toolbar-button.ts:17:15)
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/blocks/list.spec.js:1166:3
should replace selected non-breaking spaces from the toolbar in /test/e2e/specs/editor/various/rich-text.spec.js, passed after 1 failed attempt.
Error: expect(received).toMatchObject(expected)

- Expected  - 1
+ Received  + 1

  Array [
    Object {
      "attributes": Object {
-       "content": "one two three",
+       "content": "ne two three",
      },
      "name": "core/paragraph",
    },
  ]

Call Log:
- Timeout 5000ms exceeded while waiting on the predicate
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/various/rich-text.spec.js:1050:41
should update the URL from the last navigation if only varies in the URL fragment in /test/e2e/specs/interactivity/router-navigate.spec.ts, passed after 1 failed attempt.
Error: expect(locator).toHaveText(expected) failed

Locator:  getByTestId('title')
Expected: "Link 1"
Received: "Main"
Timeout:  5000ms

Call log:
  - Expect "toHaveText" getByTestId('title') with timeout 5000ms
  - waiting for getByTestId('title')
    14 × locator resolved to <h2 data-testid="title">Main</h2>
       - unexpected value "Main"

    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/interactivity/router-navigate.spec.ts:160:25
shows block preview when hovering over block in inserter in /test/e2e/specs/editor/various/inserting-blocks.spec.js, passed after 1 failed attempt.
Error: expect(locator).toBeInViewport() failed

Locator: locator('.block-editor-inserter__preview')
Expected: in viewport
Timeout: 5000ms
Error: element(s) not found

Call log:
  - Expect "toBeInViewport" locator('.block-editor-inserter__preview') with timeout 5000ms
  - waiting for locator('.block-editor-inserter__preview')

    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/various/inserting-blocks.spec.js:819:5
shows title and sync status while creating a new synced pattern in the post editor in /test/e2e/specs/editor/various/post-summary/post-summary.spec.js, passed after 1 failed attempt.
Error: expect(locator).toBeVisible() failed

Locator: getByRole('dialog', { name: 'Create pattern' })
Expected: visible
Timeout: 5000ms
Error: element(s) not found

Call log:
  - Expect "toBeVisible" getByRole('dialog', { name: 'Create pattern' }) with timeout 5000ms
  - waiting for getByRole('dialog', { name: 'Create pattern' })

    at createPatternFromModal (/home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/various/post-summary/post-summary.spec.js:179:26)
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/various/post-summary/post-summary.spec.js:101:4

34fb365 Run

@mirka
mirka requested a review from a team October 26, 2026 04:50
@mirka
mirka marked this pull request as ready for review October 26, 2026 04:50
@mirka
mirka requested a review from manzoorwanijk as a code owner October 26, 2026 04:50

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

LGTM 👍

Assuming that deprecations and migrations will continue, do we have the general process outlined anywhere? For my own review confidence, but also something we could delegate to AI agents for implementation and review.

@mirka

mirka commented Oct 26, 2026

Copy link
Copy Markdown
Member Author

Not in one place yet. The pieces are spread out between the soft-deprecation steps in the components contributing guide, the Design System packages guide for parity and compatibility checks, and the use-recommended-components docs with the per-component migration guides. What's missing is the sequence itself, like when a WC* alias goes into use-import-as, when a component moves to the denylist, and what a reviewer should check at each step.

I agree it should be written down. I'll look into this.

@mirka
mirka merged commit f4dbd41 into trunk Oct 26, 2026
106 checks passed
@mirka
mirka deleted the enforce-card-import-alias branch October 26, 2026 14:13
@github-actions github-actions Bot added this to the Gutenberg 24.4 milestone Oct 26, 2026
@ingeniumed ingeniumed added the [Package] Components /packages/components label Nov 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Package] Components /packages/components [Package] Preferences /packages/preferences [Type] Code Quality Issues or PRs that relate to code quality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants