Skip to content

ESLint: Allow 'Use with caution' components in all of Storybook - #87535

Merged
simison merged 2 commits into
trunkfrom
simison/eslint-storybook-recommended-components
Nov 27, 2026
Merged

simison merged 2 commits into
trunkfrom
simison/eslint-storybook-recommended-components

Conversation

@simison

@simison simison commented Nov 27, 2026 •

Copy link
Copy Markdown
Member

What?

Gives all of Storybook (storybook/**) its own @wordpress/use-recommended-components override in tools/eslint/config.mjs.

Before, only storybook/stories/** was covered, and the rule was turned off there. Now Storybook runs it with allowUseWithCaution: true instead. packages/components/** keeps the rule off.

Why?

Suggested in #86918 (comment): anything in Storybook can reasonably opt in to newer components early. This replaces adding Storybook subdirectories (such as storybook/components/**) to the override one at a time.

Earlier disabling the rule mixed two concerns: using new components early, and not using deprecated ones.

With allowUseWithCaution: true, Storybook can use "Use with caution" components while deprecated imports are still flagged, unlike before.

A story that imports a @wordpress/ui component marked "Not recommended" is still flagged. This happened when the original override was added in #76463, before the "Use with caution" tier existed. If it comes up, an inline eslint-disable-next-line on that import seems fine.

Testing Instructions

  • npm run lint:js -- tools/eslint/config.mjs storybook passes (taken care by CI)
  • Add import { TextControl } from '@wordpress/components'; to any file under storybook/stories/, then run npm run lint:js on that file. Confirm it reports @wordpress/use-recommended-components.

@github-actions

github-actions Bot commented Nov 27, 2026 •

Copy link
Copy Markdown

🤖 PR meta 🤖

Preview in WordPress Playground Preview in Storybook

🎉 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: simison <simison@git.wordpress.org>
Co-authored-by: ciampo <mciampini@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: 8.73 MB

7650b9e Run

@simison
simison marked this pull request as ready for review November 27, 2026 09:39
@simison
simison requested a review from a team November 27, 2026 09:39
@github-actions
github-actions Bot requested review from aduth and ciampo November 27, 2026 09:39
@simison simison changed the title ESLint: Disable use-recommended-components for all of Storybook ESLint: Allow 'Use with caution' components in all of Storybook Nov 27, 2026
@simison simison added [Type] Code Quality Issues or PRs that relate to code quality Storybook Storybook and its stories for components labels Nov 27, 2026
@simison
simison force-pushed the simison/eslint-storybook-recommended-components branch from 40ec5c4 to 7650b9e Compare November 27, 2026 14:30
@simison
simison merged commit 27a3fe5 into trunk Nov 27, 2026
65 checks passed
@simison
simison deleted the simison/eslint-storybook-recommended-components branch November 27, 2026 17:17
@github-actions github-actions Bot added this to the Gutenberg 24.6 milestone Nov 27, 2026
Vedant-Gandhi pushed a commit to Vedant-Gandhi/gutenberg that referenced this pull request Nov 30, 2026
…Press#87535)

Co-authored-by: simison <simison@git.wordpress.org>
Co-authored-by: ciampo <mciampini@git.wordpress.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Storybook Storybook and its stories for components [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