-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Add stylelint rule to prevent usage of flex-direction reverse values #63081
Changes from 5 commits
16c726d
c1ce569
db35911
af868fa
9efa055
7b6abac
00f59d5
113fc0e
c4c55b2
d47840d
5190d82
81c8982
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 | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -4,6 +4,20 @@ | |||||||||||||
"at-rule-empty-line-before": null, | ||||||||||||||
"at-rule-no-unknown": null, | ||||||||||||||
"comment-empty-line-before": null, | ||||||||||||||
"declaration-property-value-allowed-list": [ | ||||||||||||||
{ | ||||||||||||||
"flex-direction": [ | ||||||||||||||
"row", | ||||||||||||||
"column", | ||||||||||||||
"inherit", | ||||||||||||||
"initial", | ||||||||||||||
"unset" | ||||||||||||||
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. We should be able to do it with regex. I think it might be easier if we just list all the possible reverse values and with a negative regex (untested):
Suggested change
That will also allow using variables as @youknowriad raised above. 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. @tyxla sure but in order to do that we should use 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.
This is where we need to first convert the config file from JSON to JS, as well as update the Stylelint dependency to a newer version that supports custom message functions for this rule (#63090). 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. 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.
Good point, but I think you should be able to do it with
Haven't tested it, so let me know if that works for you. 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. Otherwise, converting to the JS format makes sense, although it doesn't look like a high-priority task. |
||||||||||||||
] | ||||||||||||||
}, | ||||||||||||||
{ | ||||||||||||||
"message": "Avoid the flex-direction reverse values. 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," | ||||||||||||||
t-hamano marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||
} | ||||||||||||||
], | ||||||||||||||
"declaration-property-value-disallowed-list": [ | ||||||||||||||
{ | ||||||||||||||
"/.*/": [ "/--wp-components-color-/" ] | ||||||||||||||
|
@@ -18,7 +32,7 @@ | |||||||||||||
"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" | ||||||||||||||
"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," | ||||||||||||||
t-hamano marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||
} | ||||||||||||||
], | ||||||||||||||
"rule-empty-line-before": null, | ||||||||||||||
|
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.
Is there a way to allow variables as values?