Skip to content

Commit 8f8b864

Browse files
authored
Fix function-no-unknown false positives (#8677)
1 parent 23be76c commit 8f8b864

File tree

4 files changed

+38
-4
lines changed

4 files changed

+38
-4
lines changed

.changeset/young-bananas-design.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

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,15 @@ testRule({
5252
code: 'a { animation-timing-function: linear(0, 0.25, 1); }',
5353
description: 'explicit linear check',
5454
},
55+
{
56+
code: 'h1 { string-set: Chapter content(); }',
57+
},
58+
{
59+
code: '@top-right { content: string(Chapter); }',
60+
},
61+
{
62+
code: 'a { --color: if(media(width >= 1px): red; else: green); }',
63+
},
5564
],
5665

5766
reject: [

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

Lines changed: 12 additions & 2 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: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,18 @@ import validateOptions from '../../utils/validateOptions.mjs';
1616
const require = createRequire(import.meta.url);
1717
const functionsList = require('css-functions-list/index.json');
1818

19-
/** @todo submit PR to css-functions-list */
20-
const FUNCTIONS = [...functionsList, 'running'];
19+
const FUNCTIONS = [
20+
...functionsList,
21+
// https://drafts.csswg.org/css-values-5/#if-notation
22+
'if',
23+
'media',
24+
'style',
25+
'supports',
26+
// niksy/css-functions-list#10
27+
'content',
28+
'running',
29+
'string',
30+
];
2131

2232
const ruleName = 'function-no-unknown';
2333

0 commit comments

Comments
 (0)