Skip to content

Commit c33479b

Browse files
authored
Fix function-no-unknown false positives for contrast-color() and sibling-*() (#8729)
1 parent 2d1abb9 commit c33479b

File tree

4 files changed

+21
-0
lines changed

4 files changed

+21
-0
lines changed

.changeset/little-rats-lay.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"stylelint": patch
3+
---
4+
5+
Fixed: `function-no-unknown` false positives for `contrast-color()` and `sibling-*()`

lib/rules/function-no-unknown/__tests__/index.mjs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,12 @@ testRule({
6161
{
6262
code: 'a { --color: if(media(width >= 1px): red; else: green); }',
6363
},
64+
{
65+
code: '.foo { --bar: sibling-index(); column-count: sibling-count(); }',
66+
},
67+
{
68+
code: 'a { color: contrast-color(var(--qux)); }',
69+
},
6470
],
6571

6672
reject: [

lib/rules/function-no-unknown/index.cjs

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/rules/function-no-unknown/index.mjs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@ const FUNCTIONS = [
2727
'content',
2828
'running',
2929
'string',
30+
// https://drafts.csswg.org/css-values-5/#tree-counting
31+
'sibling-count',
32+
'sibling-index',
33+
// https://drafts.csswg.org/css-color-5/#contrast-color
34+
'contrast-color',
3035
];
3136

3237
const ruleName = 'function-no-unknown';

0 commit comments

Comments
 (0)