Skip to content

Commit

Permalink
fix: add some requested missing functions from css-functions-list pac…
Browse files Browse the repository at this point in the history
…kage
  • Loading branch information
Mouvedia committed Dec 23, 2022
1 parent e30ec86 commit 2909534
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
@@ -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
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
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 2909534

Please sign in to comment.