10up-toolkit icon indicating copy to clipboard operation
10up-toolkit copied to clipboard

Stylelint custom-property-pattern doesn't fully support variables created by theme.json

Open kdo opened this issue 2 years ago • 3 comments

Describe the bug

Related to https://github.com/10up/10up-toolkit/issues/300 and https://github.com/10up/10up-toolkit/pull/314

theme.json generates font size and font family variables with mixed kebab-case and wp--kebab--case, for example: --wp--preset--font-family--headline or --wp--preset--font-size--lg.

This throws stylelint error: Expected custom property name to be kebab-case or wp--kebab--case custom-property-pattern

Steps to Reproduce

  1. Add font size or font family variable in theme.json
  2. Use generated variable in theme CSS
  3. Stylelint throws error

Screenshots, screen recording, code snippet

No response

Environment information

No response

WordPress information

No response

Code of Conduct

  • [X] I agree to follow this project's Code of Conduct

kdo avatar Nov 10 '23 01:11 kdo

Discussed in 10up-toolkit council meeting and we agreed to relax this rule.

nicholasio avatar Nov 20 '23 15:11 nicholasio

@Antonio-Laguna would this be a breaking change? should we include it as part of v6/the next major of stylelint

nicholasio avatar Jan 09 '24 02:01 nicholasio

@nicholasio I don't think so since it does relax the rule? This needs to be fixed though plus another minor thing I found around nesting for stylelint

Antonio-Laguna avatar Jan 09 '24 06:01 Antonio-Laguna