-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Stylelint: Migrate configuration from JSON
to JavaScript
format
#69590
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
Conversation
e21a88e
to
14ed9bc
Compare
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 If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
14ed9bc
to
3c98667
Compare
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.
I think this is a great enhancement. It will also be possible to add complex custom rules.
We could make the message more specific as a follow-up:
module.exports = {
rules: {
'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.`,
},
],
},
};
Nit: Can you update this too?
├── .stylelintrc.json |
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.
Copilot reviewed 3 out of 4 changed files in this pull request and generated no comments.
Files not reviewed (1)
- .stylelintrc.json: Language not supported
7381047
to
8dbf3f7
Compare
Well noted, once this PR is shipped. I will create a follow-up targeting the specific enhancement issue. As suggested earlier in this comment #63048 (comment).
I have fixed this now. Thanks @t-hamano for the review. |
…ordPress#69590) * feat: Convert stylelint file to .js * fix: Correct folder structure in docs * chore: Add changelog entry * chore: Remove changelog entry * chore: Remove changelog entry Co-authored-by: im3dabasia <[email protected]> Co-authored-by: t-hamano <[email protected]> Co-authored-by: afercia <[email protected]>
What?
Closes #63090
Convert
Stylelint
configuration fromJSON
toJavaScript
format to enable custom rule messagesWhy?
As our
Stylelint
rules expand, we need more flexible configuration options. The current JSON format is limiting our ability to provide clear, specific messages for each rule violation.As noted by @mirka in #63048, converting to JavaScript format will allow us to configure the message property as a function, providing different warning messages for each violation type. This requires at least Stylelint version 14.5.0 which supports this feature. (Current Stylelint version is 16.8.2 in GB).
How?
.stylelintrc.json
to.stylelintrc.js