-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Components: Add eslint rule for theme var regressions #58130
Conversation
{ | ||
selector: 'Literal[value=/--wp-admin-theme-/]', | ||
message: | ||
'--wp-admin-theme-* variables do not support component theming. Use variables from the COLORS object in packages/components/src/utils/colors-values.js instead.', | ||
}, | ||
{ | ||
selector: | ||
'TemplateElement[value.cooked=/--wp-admin-theme-/]', | ||
message: | ||
'--wp-admin-theme-* variables do not support component theming. Use variables from the COLORS object in packages/components/src/utils/colors-values.js instead.', | ||
}, |
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.
These two selectors will cover matches within string and template literals. (But not other types of nodes like comments.)
Size Change: -63 B (0%) Total Size: 1.7 MB
ℹ️ View Unchanged
|
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.
🚀
Including some entries from my recent PRs
Part of #44116
What?
Adds a Eslint rule for JS/TS files under
packages/components
to prevent unknowing usage of--wp-admin-theme-*
color variables.Why?
--wp-admin-theme-*
variables are coupled with wp-admin and do not support our component theming system.This PR is the Eslint counterpart of the Stylelint rules proposed in #58098.
Testing Instructions
npm run lint:js
. It should error on the offending files underpackages/components
.