Skip to content

Commit

Permalink
Simplify with :matches
Browse files Browse the repository at this point in the history
  • Loading branch information
mirka committed Feb 15, 2024
1 parent 3ff2d69 commit b767fe3
Showing 1 changed file with 3 additions and 13 deletions.
16 changes: 3 additions & 13 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -361,26 +361,16 @@ module.exports = {
rules: {
'no-restricted-syntax': [
'error',
{
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-/]',
':matches(Literal[value=/--wp-admin-theme-/],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.',
},
{
selector:
'Literal[value=/var.+--wp-components-color-/]', // allow overriding definitions, but not access with var()
message:
'To ensure proper fallbacks, --wp-components-color-* variables should not be used directly. Use variables from the COLORS object in packages/components/src/utils/colors-values.js instead.',
},
{
selector:
'TemplateElement[value.cooked=/var.+--wp-components-color-/]', // allow overriding definitions, but not access with var()
// Allow overriding definitions, but not access with var()
':matches(Literal[value=/var.+--wp-components-color-/],TemplateElement[value.cooked=/var.+--wp-components-color-/])',
message:
'To ensure proper fallbacks, --wp-components-color-* variables should not be used directly. Use variables from the COLORS object in packages/components/src/utils/colors-values.js instead.',
},
Expand Down

0 comments on commit b767fe3

Please sign in to comment.