Add ignoreFunctions: [] to unit-allowed-list
See original GitHub issueWhat steps are needed to reproduce the bug?
Use css/scss functions that include a disallowed unit character.
button {
border: 1px solid hsl(20deg 0% 20% / 80%);
background-color: lighten(green, 20%);
}
What Stylelint configuration is needed to reproduce the bug?
{
"rules": {
"unit-allowed-list": "px"
}
}
How did you run Stylelint?
CLI stylelint **/*.scss
Which version of Stylelint are you using?
14.2.0
What did you expect to happen?
Units within function to be ignored.
What actually happened?
The following problems were reported
2:25 errorUnexpected unit "deg" (unit-allowed-list)
2:31 errorUnexpected unit "%" (unit-allowed-list)
2:34 errorUnexpected unit "%" (unit-allowed-list)
2:40 errorUnexpected unit "%" (unit-allowed-list)
3:36 errorUnexpected unit "%" (unit-allowed-list)
Does the bug relate to non-standard syntax?
Yes, SCSS color functions and vanilla HSL functions
Proposal to fix the bug
Add ignore: ["inside-function"]
secondary option to unit-allowed-list, similar fix to https://github.com/stylelint/stylelint/issues/5140
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
Changelog | Stylelint
Added : ignoreFunctions: [] to unit-allowed-list (#5857). Added: camelCaseSvgKeywords to value-keyword-case - use this option if you want legacy camel case ...
Read more >stylelint 14.3.0 on Node.js Yarn - NewReleases.io
Added : ignoreFunctions: [] to unit-allowed-list (#5857). Added: camelCaseSvgKeywords to value-keyword-case - use this option if you want legacy camel case ...
Read more >.stylelintrc - Qiita
"unit-allowed-list": ["単位名1","単位名2","単位名3"] ... 任意の文字列"] "ignoreFunctions": [正規表現, "任意の文字列"] ...
Read more >CSSタグが付けられた新着記事 - Qiita
"unit-allowed-list": ["単位名1","単位名2","単位名3"] //オプション"ignoreProperties": ... 任意の文字列"] "ignoreFunctions": [正規表現, "任意の文字列"] ...
Read more >Stylelint Stylelint Issues - IssueHint
Add message arguments to `declaration-property-unit-allowed-list` ... Fix `value-keyword-case` false positives for mixed case `ignoreFunctions` option ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Okay, let’s go with
ignoreFunctions: []
.I’ve labelled the issue as ready to implement. @treemmett Please consider contributing if you have time.
There are steps on how to add a new option in the Developer guide.
A new option sounds good.
I’m wondering whether we missed an opportunity when we added
ignore: ["inside-function"]
to those other rules. It’s too broad. If we pivot to a user defined list option, i.e.ignoreFunctions: []
we can cater to the above use case and others.For example, given:
Would allow:
But disallow:
(When you want font sizes always in pixels).
You can still ignore all functions using this option by using regex in the list.
Thoughts?