Skip to content

Add stylelint CSS linting - #12934

Draft
afercia wants to merge 6 commits into
WordPress:trunkfrom
afercia:add-stylelint-linting
Draft

Add stylelint CSS linting#12934
afercia wants to merge 6 commits into
WordPress:trunkfrom
afercia:add-stylelint-linting

Conversation

@afercia

@afercia afercia commented Aug 7, 2026

Copy link
Copy Markdown
Member

Trac ticket: https://core.trac.wordpress.org/ticket/29792

Work In Progress (WIP) to add Stylelint CSS coding standards rules enforcement to Core.

So far, this PR adds:

  • An NPM script with the same set or rules used in Gutenberg.
  • A Grunt task that can be run individually and is also part of grunt precommit:css.

For now, it is important to check the following:

  • Whether the excluded paths make sense.
  • Whether there is the need to add more files to scan.
  • Make sure that the results are consistent when running:
    • npm run lint:css
    • grunt lint:css

Don't forget to run npm install before testing.

As of Core revision 63157, the Stylelint scan reports the following:

✖ 2823 problems (2823 errors, 0 warnings)
  2135 errors potentially fixable with the "--fix" option.

Most of these errors are trivial fixes.

The scan also reports one occurrence of the order property and one of the row-reverse value, which confirms the custom rules work as expected.

Nest steps: Add a related GitHub Action.

Use of AI Tools

None.


This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.

@afercia afercia changed the title Add stylelint linting Add stylelint CSS linting Aug 7, 2026
@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown

Test using WordPress Playground

The changes in this pull request can previewed and tested using a WordPress Playground instance.

WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser.

Some things to be aware of

  • All changes will be lost when closing a tab with a Playground instance.
  • All changes will be lost when refreshing the page.
  • A fresh instance is created each time the link below is clicked.
  • Every time this pull request is updated, a new ZIP file containing all changes is created. If changes are not reflected in the Playground instance,
    it's possible that the most recent build failed, or has not completed. Check the list of workflow runs to be sure.

For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation.

Test this pull request with WordPress Playground.

@afercia

afercia commented Aug 7, 2026

Copy link
Copy Markdown
Member Author

Nice, given the new lint:css grunt task is added to grunt precommit:css, it already runs on the GitHub Actions and the Run SASS precommit tasks step of the update-built-files job fails.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant