Skip to content

Stylelint: Enforce module class naming in UI packages#79504

Merged
ciampo merged 2 commits into
trunkfrom
codex/enable-selector-class-pattern-modules
Jun 25, 2026
Merged

Stylelint: Enforce module class naming in UI packages#79504
ciampo merged 2 commits into
trunkfrom
codex/enable-selector-class-pattern-modules

Conversation

@ciampo

@ciampo ciampo commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

What?

Follow up to #79445 (comment).

Enable selector-class-pattern for CSS Modules in the component-library packages: components, ui, and theme.

Why?

This keeps new CSS Module class names kebab-case without forcing the same rule onto legacy non-module styles.

How?

Adds a targeted Stylelint override for *.module.{css,scss} files in those packages, then renames the existing @wordpress/ui module classes that violated it.

Testing Instructions

  1. Run the focused Stylelint check for module styles in components, ui, and theme.
  2. Run JS lint for the touched UI files and Stylelint config.
  3. Run the packages/ui TypeScript build.
  4. Confirm the diff has no whitespace errors.

Testing Instructions for Keyboard

Not applicable; this is a linting/class-name cleanup and does not change keyboard behavior.

Screenshots or screencast

Not applicable; no visual change expected.

Use of AI Tools

Prepared with assistance from OpenAI Codex and reviewed locally.

@github-actions github-actions Bot added the [Package] UI /packages/ui label Jun 24, 2026
@ciampo ciampo self-assigned this Jun 24, 2026
@ciampo ciampo added the [Type] Code Quality Issues or PRs that relate to code quality label Jun 24, 2026
@ciampo ciampo marked this pull request as ready for review June 24, 2026 19:53
@ciampo ciampo requested review from a team and manzoorwanijk as code owners June 24, 2026 19:53
@github-actions

github-actions Bot commented Jun 24, 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: ciampo <mciampini@git.wordpress.org>
Co-authored-by: mirka <0mirka00@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

github-actions Bot commented Jun 24, 2026

Copy link
Copy Markdown

Size Change: -7 B (0%)

Total Size: 7.51 MB

📦 View Changed
Filename Size Change
build/modules/content-types/index.min.js 160 kB -3 B (0%)
build/scripts/block-editor/index.min.js 383 kB +2 B (0%)
build/scripts/editor/index.min.js 476 kB -6 B (0%)

compressed-size-action

Comment thread packages/ui/src/alert-dialog/popup.tsx Outdated
className={ clsx(
overlayChromeStyles.content,
focusStyles[ 'outset-ring--focus-visible' ]
focusStyles[ 'outset-ring-focus-visible' ]

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.

Hmm, maybe this should have been outset-ring__focus-visible or something? The focus module classes in particular make me want namespacing to be clearer. But even for some other shared modules, we may find it more readable to have clear namespacing in certain cases in the future.

My only concern would be that namespacing with __ doesn't map cleanly to BEM principles in this case 🤔 I'm fine with either double hyphens or double underscores, but I think we may have readability issues if we enforce single hyphens only.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense, I will relax the pattern to allow --

@ciampo ciampo force-pushed the codex/enable-selector-class-pattern-modules branch from 714e1ea to 06062f9 Compare June 25, 2026 13:21
@ciampo ciampo requested a review from ajitbohra as a code owner June 25, 2026 13:21
@github-actions github-actions Bot added the [Package] Components /packages/components label Jun 25, 2026
@ciampo ciampo requested a review from mirka June 25, 2026 13:23

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

Looks good, thanks!

@ciampo ciampo merged commit 9bc06be into trunk Jun 25, 2026
48 checks passed
@ciampo ciampo deleted the codex/enable-selector-class-pattern-modules branch June 25, 2026 14:40
@github-actions github-actions Bot added this to the Gutenberg 23.6 milestone Jun 25, 2026
SainathPoojary pushed a commit to SainathPoojary/gutenberg that referenced this pull request Jun 29, 2026
* Stylelint: Enforce module class naming in UI packages

* Stylelint: Allow namespaced module classes

---

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

Labels

[Package] Components /packages/components [Package] UI /packages/ui [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