-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Stylelint: Enforce class naming for all stylesheets #79900
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
cc2d35d
8d33220
a9464c4
2233a96
e71717c
50a7fda
f537a69
99769ce
43c50b0
92f026c
a387c31
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -113,8 +113,9 @@ | |
| "format:php": "wp-env run --env-cwd='wp-content/plugins/gutenberg' cli composer run-script format", | ||
| "prelint:js": "npm run --if-present --workspaces prelint:js", | ||
| "lint": "concurrently \"npm run lint:lockfile\" \"npm run lint:tsconfig\" \"npm run lint:js\" \"npm run lint:pkg-json\" \"npm run lint:deps\" \"npm run lint:css\"", | ||
| "lint:css": "wp-scripts lint-style \"**/*.scss\" \"**/*.module.css\"", | ||
| "lint:css": "wp-scripts lint-style --suppress-location=tools/stylelint/stylelint-suppressions.json \"**/*.scss\" \"**/*.module.css\"", | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What about non-module css files, such as I think that If we make changes here, we may need to also reflect them to #79918?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When I considered this, it seemed to me that this repo generally does not treat plain
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I actually just tried linting everything right now, and the diff actually seems simpler than I expected. I'll see if the switch is feasible.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| "lint:css:fix": "npm run lint:css -- --fix", | ||
| "lint:css:update-suppressions": "npm run lint:css -- --suppress && wp-scripts format tools/stylelint/stylelint-suppressions.json", | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unlike the eslint version, stylelint doesn't have separate "add suppressions" and "prune suppressions" commands. So the command name reflects that, rather than keep parity with the eslint version where it's called |
||
| "lint:deps": "syncpack lint", | ||
| "lint:deps:fix": "syncpack fix", | ||
| "lint:js": "node ./tools/eslint/lint-js.cjs --concurrency=auto", | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,152 @@ | ||
| { | ||
| "widgets/events/style.module.css": { | ||
| "selector-class-pattern": { | ||
| "count": 3 | ||
| } | ||
| }, | ||
| "widgets/quick-draft/style.module.css": { | ||
| "selector-class-pattern": { | ||
| "count": 6 | ||
| } | ||
| }, | ||
| "widgets/site-preview/style.module.css": { | ||
| "selector-class-pattern": { | ||
| "count": 8 | ||
| } | ||
| }, | ||
| "packages/grid/src/dashboard-grid/grid.module.css": { | ||
| "selector-class-pattern": { | ||
| "count": 6 | ||
| } | ||
| }, | ||
| "packages/grid/src/dashboard-lanes/lanes.module.css": { | ||
| "selector-class-pattern": { | ||
| "count": 6 | ||
| } | ||
| }, | ||
| "widgets/news/components/news-list/news-list.module.css": { | ||
| "selector-class-pattern": { | ||
| "count": 2 | ||
| } | ||
| }, | ||
| "widgets/events/components/events-list/events-list.module.css": { | ||
| "selector-class-pattern": { | ||
| "count": 5 | ||
| } | ||
| }, | ||
| "widgets/events/components/location-picker/location-picker.module.css": { | ||
| "selector-class-pattern": { | ||
| "count": 1 | ||
| } | ||
| }, | ||
| "widgets/quick-draft/components/drafts-list/drafts-list.module.css": { | ||
| "selector-class-pattern": { | ||
| "count": 5 | ||
| } | ||
| }, | ||
| "widgets/quick-draft/components/saved-post/saved-post.module.css": { | ||
| "selector-class-pattern": { | ||
| "count": 1 | ||
| } | ||
| }, | ||
| "widgets/welcome/components/banner/banner.module.css": { | ||
| "selector-class-pattern": { | ||
| "count": 2 | ||
| } | ||
| }, | ||
| "widgets/welcome/components/feature-highlight/feature-highlight.module.css": { | ||
| "selector-class-pattern": { | ||
| "count": 1 | ||
| } | ||
| }, | ||
| "packages/widget-dashboard/src/components/actions/actions.module.css": { | ||
| "selector-class-pattern": { | ||
| "count": 7 | ||
| } | ||
| }, | ||
| "packages/widget-dashboard/src/components/widget-chrome/widget-chrome.module.css": { | ||
| "selector-class-pattern": { | ||
| "count": 3 | ||
| } | ||
| }, | ||
| "packages/widget-dashboard/src/components/widget-frame/widget-frame.module.css": { | ||
| "selector-class-pattern": { | ||
| "count": 1 | ||
| } | ||
| }, | ||
| "packages/widget-dashboard/src/components/widget-header/widget-header.module.css": { | ||
| "selector-class-pattern": { | ||
| "count": 2 | ||
| } | ||
| }, | ||
| "packages/widget-dashboard/src/components/widget-toolbar/widget-toolbar.module.css": { | ||
| "selector-class-pattern": { | ||
| "count": 1 | ||
| } | ||
| }, | ||
| "packages/widget-dashboard/src/components/widgets/widget-resize-handle.module.css": { | ||
| "selector-class-pattern": { | ||
| "count": 21 | ||
| } | ||
| }, | ||
| "packages/widget-dashboard/src/components/widgets/widgets.module.css": { | ||
| "selector-class-pattern": { | ||
| "count": 4 | ||
| } | ||
| }, | ||
| "packages/widget-dashboard/src/components/layout-settings/layout-model-edit-field/style.module.css": { | ||
| "selector-class-pattern": { | ||
| "count": 3 | ||
| } | ||
| }, | ||
| "routes/template-list/add-new-template/style.scss": { | ||
| "selector-class-pattern": { | ||
| "count": 1 | ||
| } | ||
| }, | ||
| "packages/block-library/src/image/editor.scss": { | ||
| "selector-class-pattern": { | ||
| "count": 2 | ||
| } | ||
| }, | ||
| "packages/block-library/src/navigation/style.scss": { | ||
| "selector-class-pattern": { | ||
| "count": 1 | ||
| } | ||
| }, | ||
| "packages/block-library/src/social-link/editor.scss": { | ||
| "selector-class-pattern": { | ||
| "count": 1 | ||
| } | ||
| }, | ||
| "packages/global-styles-ui/src/font-library/style.scss": { | ||
| "selector-class-pattern": { | ||
| "count": 2 | ||
| } | ||
| }, | ||
| "packages/global-styles-ui/src/variations/style.scss": { | ||
| "selector-class-pattern": { | ||
| "count": 6 | ||
| } | ||
| }, | ||
| "packages/block-editor/src/components/link-control/style.scss": { | ||
| "selector-class-pattern": { | ||
| "count": 1 | ||
| } | ||
| }, | ||
| "packages/dataviews/src/components/dataviews-filters/style.scss": { | ||
| "selector-class-pattern": { | ||
| "count": 1 | ||
| } | ||
| }, | ||
| "packages/edit-site/src/components/add-new-template/style.scss": { | ||
| "selector-class-pattern": { | ||
| "count": 1 | ||
| } | ||
| }, | ||
| "packages/edit-site/src/components/sidebar-navigation-screen/style.scss": { | ||
| "selector-class-pattern": { | ||
| "count": 5 | ||
| } | ||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The stylelint
suppresscommand will both add and prune suppressions in the same pass. This means that on CI, we need a first pass to flag violations (and fail the job), and then a second pass to prune stale suppressions.This second pass is estimated to add about 15 secs on CI (not completely negligible in absolute terms, but negligible in the context of the entire static checks job).