Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
998b454
First pass at adding a stylelint script.
afercia Aug 6, 2026
422a3b7
Remove custom rule from gutenberg.
afercia Aug 6, 2026
927c036
Clean up stylelintignore.
afercia Aug 6, 2026
89d8b53
Clean up config.
afercia Aug 6, 2026
dde3bbc
Add Grunt task and clean up.
afercia Aug 7, 2026
3ccc502
Remove stylelint-config-wordpress package.
afercia Aug 7, 2026
ac8915c
Ignore admin color scheme auto generated files.
afercia Aug 8, 2026
6ab9a4c
Ignore files copied to wp-includes js.
afercia Aug 8, 2026
ba06aa2
Remove Stylelint configuration from Twenty Twenty theme.
afercia Aug 9, 2026
4f8d76d
Remove Stylelint configuration from Twenty Twenty-One theme.
afercia Aug 9, 2026
afa60f9
Remove comments.
afercia Aug 9, 2026
b14bd86
Add lint:css:themes script for bundled themes.
afercia Aug 9, 2026
9fb042c
Build theme files.
afercia Aug 9, 2026
764c162
Use the root stylelintrc for twentytwentyone.
afercia Aug 9, 2026
249264b
For twentytwentyone try adding a postcss script and run it twice.
afercia Aug 10, 2026
750ce8a
Start refining rules.
afercia Aug 10, 2026
585ca96
Add rules for empty lines before.
afercia Aug 10, 2026
712b258
Solve the indentation and leading space issues avoiding to run postcs…
afercia Aug 10, 2026
7a4aae3
Improve comment-empty-line-before.
afercia Aug 10, 2026
d0dad73
Improve comment.
afercia Aug 10, 2026
918fa17
Improve selector-list-comma-space-after.
afercia Aug 10, 2026
bd7f005
Refine empty libe before rule.
afercia Aug 11, 2026
6997879
Add selector-no-qualifying-type warning.
afercia Aug 11, 2026
d75b235
Refine more rules.
afercia Aug 11, 2026
3325172
Improve order of rules related to indentation.
afercia Aug 11, 2026
55dea77
Reduce max-empty-lines to 1.
afercia Aug 11, 2026
59e1619
Disable comment-empty-line-before.
afercia Aug 11, 2026
41189d5
Run stylelint directly so that it walks upwards until it finds the ro…
afercia Aug 11, 2026
34f68ca
Update test-and-zip-default-themes gh action.
afercia Aug 11, 2026
76dcbef
Add bacl @wordpress/scripts to twentytwentyone.
afercia Aug 11, 2026
72b4f38
Add stylelint-plugin-logical-css to twentytwentyone.
afercia Aug 11, 2026
95feafb
Update twentytwentyone styles.
afercia Aug 11, 2026
3512b19
Pass the glob as a quoted pattern.
afercia Aug 11, 2026
0c910c3
Add optimizeLegibility to value-keyword-case exceptions.
afercia Aug 12, 2026
fbc64f2
Add @stylistic/selector-descendant-combinator-no-non-space true.
afercia Aug 12, 2026
aa10d74
Adjust a few rules.
afercia Aug 17, 2026
4b9ca51
Ignore dashicons font-family.
afercia Aug 17, 2026
8eb1a68
Apply a few minor JS coding standards to stylelintrc.js.
afercia Aug 17, 2026
aef6d21
Try warnings threshold mechanism.
afercia Aug 19, 2026
a41a407
Normalize the glob path for Windows on CI.
afercia Aug 19, 2026
fe2d5ac
Increase warnings threshold.
afercia Sep 5, 2026
fda28cb
Remove all changes related to themes.
afercia Sep 11, 2026
db00d3a
Align threshold with current trunk.
afercia Sep 23, 2026
6e8a976
Build/Test Tools: Use Stylelint bulk suppressions as the CSS baseline.
lancewillett Sep 23, 2026
1cf8b05
Build/Test Tools: Treat the Stylelint config files as configuration i…
lancewillett Sep 23, 2026
8d60e1f
Make the class selector pattern match the current coding standards.
afercia Sep 28, 2026
e9c8492
Revert changes to css files.
afercia Sep 28, 2026
5af9956
Upgrade sylelint and stylelint-plugin-logical-css versions.
afercia Sep 28, 2026
0adeb1b
Checkout latest css changes from trunk.
afercia Sep 29, 2026
016147c
Update Stylelint suppressions list.
afercia Sep 29, 2026
54be2b0
Rebase and update suppressions list.
afercia Oct 2, 2026
2d36ecd
Address part of CR.
afercia Oct 2, 2026
cf0bce5
Add lint:css:update-suppressions script.
afercia Oct 2, 2026
bd9c00e
Improve error message and add instructions.
afercia Oct 5, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions .stylelintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Ignore WordPress plugin files.
src/wp-content/plugins/**/*

# Ignore WordPress theme files.
src/wp-content/themes/**/*

# Ignore WordPress block files.
src/wp-includes/blocks/**/*

# Ignore admin color schemes auto generated files.
src/wp-admin/css/colors/*/*.css

# Ignore WordPress included dist files.
src/wp-includes/css/dist/**/*

# Ignore files copied to wp-includes js.
src/wp-includes/js/**/*

# Ignore WordPress JS vendor files.
src/js/_enqueues/vendor/**/*

# Ignore minified CSS files.
**/*.min.css

# Ignore RTL CSS files.
**/*-rtl.css
**/*-rtl.min.css
106 changes: 106 additions & 0 deletions .stylelintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
/** @type {import('stylelint').Config} */
module.exports = {
extends: '@wordpress/stylelint-config/scss-stylistic',
plugins: [
'stylelint-plugin-logical-css',
'@wordpress/theme/stylelint-plugins/no-token-fallback-values',
],
reportNeedlessDisables: true,
rules: {
'at-rule-empty-line-before': [
'always',
{
except: [ 'blockless-after-blockless' ],
ignore: [ 'first-nested', 'after-comment' ],
},
],
'at-rule-no-unknown': null,
'comment-empty-line-before': null,
'declaration-property-unit-allowed-list': [
{
'line-height': [],
},
],
'declaration-property-value-allowed-list': [
{
'flex-direction': '/^(?!(row|column)-reverse).*$/',
},
{
message: ( property, value ) =>
`Avoid "${ value }" value for the "${ property }" property. For accessibility reasons, visual, reading, and DOM order must match. Only use the reverse values when they do not affect reading order, meaning, and interaction.`,
},
],
'font-family-no-missing-generic-family-keyword': [
true,
{
ignoreFontFamilies: [ 'dashicons' ],
},
],
'font-weight-notation': 'numeric',
'function-disallowed-list': [ 'rgb' ],
'no-descending-specificity': null,
'no-invalid-position-at-import-rule': null,
'property-disallowed-list': [
[ 'order' ],
{
message:
'Avoid the order property. For accessibility reasons, visual, reading, and DOM order must match. Only use the order property when it does not affect reading order, meaning, and interaction.',
},
],
'rule-empty-line-before': [
'always',
{
except: [ 'first-nested' ],
ignore: [ 'after-comment' ],
},
],
'selector-class-pattern': [
'^([a-z][a-z0-9]*)(-[a-z0-9]+)*$',
{
message:
'Class selector should use lowercase and separate words with hyphens',
},
],
'selector-id-pattern': [
'^([a-z][a-z0-9]*)(-[a-z0-9]+)*$',
{
message:
'ID selector should use lowercase and separate words with hyphens',
},
],
'selector-no-qualifying-type': true,
'value-keyword-case': [
'lower',
{
ignoreKeywords: [
'currentColor',
'optimizeLegibility',
],
},
],
'scss/at-else-empty-line-before': null,
'scss/at-extend-no-missing-placeholder': null,
'scss/at-if-closing-brace-newline-after': null,
'scss/at-if-closing-brace-space-after': null,
'scss/comment-no-empty': null,
'scss/load-partial-extension': null,
'scss/no-global-function-names': null,
'scss/operator-no-newline-after': null,
'scss/operator-no-unspaced': null,
'scss/selector-no-redundant-nesting-selector': null,
'@stylistic/max-empty-lines': 1,
'@stylistic/max-line-length': null,
'@stylistic/selector-descendant-combinator-no-non-space': true,
// Keep these lines. Don't change their order otherwise indentation will break.
// It's not about a literal 'execution order', but rather a compatibility issue.
'@stylistic/block-closing-brace-newline-before': 'always',
'@stylistic/block-opening-brace-newline-after': 'always',
'@stylistic/declaration-block-semicolon-newline-after': 'always',
'@stylistic/selector-list-comma-space-after': 'always-single-line',
'@stylistic/selector-list-comma-newline-after': 'always',
'@stylistic/declaration-colon-newline-after': 'always-multi-line',
'@stylistic/indentation': 'tab',
// End keep these lines.
},
reportDescriptionlessDisables: true,
};
17 changes: 15 additions & 2 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -1823,8 +1823,21 @@ module.exports = function(grunt) {
'qunit:compiled'
] );

grunt.registerTask( 'lint:css', 'Runs Stylelint on core CSS.', function() {
var done = this.async();

grunt.util.spawn( {
cmd: 'node',
args: [ 'tools/stylelint/lint-css.js' ],
opts: { stdio: 'inherit' }
}, function( error ) {
done( ! error );
} );
} );

grunt.registerTask( 'precommit:css', [
'postcss:core'
'postcss:core',
'lint:css',
] );

grunt.registerTask( 'precommit:php', [
Expand Down Expand Up @@ -1921,7 +1934,7 @@ module.exports = function(grunt) {
}

if ( code === 0 ) {
if ( [ 'package.json', 'Gruntfile.js', 'composer.json' ].some( testPath ) ) {
if ( [ 'package.json', 'Gruntfile.js', 'composer.json', '.stylelintrc.js', '.stylelintignore' ].some( testPath ) ) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Changing the Stylelint config triggers the full prerelease here (PHP formatting, JS, CSS, images) when precommit:css would be enough. stylelint-suppressions.json isn't in the list either, so editing only the suppressions file runs no lint locally.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Added by @lancewillett in 71bcf1a yes, worth considering adding stylelint-suppressions.json.

grunt.log.writeln( 'Configuration files modified. Running `prerelease`.' );
taskList.push( 'prerelease' );
} else {
Expand Down
Loading
Loading