Skip to content

Commit

Permalink
Fix function-no-unknown false positives for scroll, `-webkit-grad…
Browse files Browse the repository at this point in the history
…ient`, `color-stop`, `from`, and `to` (#6539)
  • Loading branch information
Mouvedia authored Dec 23, 2022
1 parent dacd794 commit 4d32d36
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/itchy-seas-care.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"stylelint": patch
---

Fixed: `function-no-unknown` false positives for `scroll`, `-webkit-gradient`, `color-stop`, `from`, and `to`
6 changes: 6 additions & 0 deletions lib/rules/function-no-unknown/__tests__/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@ testRule({
{
code: 'a { transform: scale(0.5) translate(-100%, -100%); }',
},
{
code: 'a { animation-timeline: scroll(); }',
},
{
code: 'a { background: -webkit-gradient(linear, 0 50%, 0 100%, from(white), color-stop(0.5, yellow), to(red)); }',
},
],

reject: [
Expand Down
11 changes: 10 additions & 1 deletion lib/rules/function-no-unknown/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,16 @@ const rule = (primary, secondaryOptions) => {
return;
}

const functionsList = JSON.parse(fs.readFileSync(functionsListPath.toString(), 'utf8'));
const functionsList = [
...JSON.parse(fs.readFileSync(functionsListPath.toString(), 'utf8')),
// #5960
'-webkit-gradient',
'color-stop',
'from',
'to',
// #6537
'scroll',
];

root.walkDecls((decl) => {
const { value } = decl;
Expand Down

0 comments on commit 4d32d36

Please sign in to comment.