From 4d32d365652b3a27870a621776d11501d6990a74 Mon Sep 17 00:00:00 2001 From: Marc G Date: Fri, 23 Dec 2022 07:58:50 +0100 Subject: [PATCH] Fix `function-no-unknown` false positives for `scroll`, `-webkit-gradient`, `color-stop`, `from`, and `to` (#6539) --- .changeset/itchy-seas-care.md | 5 +++++ lib/rules/function-no-unknown/__tests__/index.js | 6 ++++++ lib/rules/function-no-unknown/index.js | 11 ++++++++++- 3 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 .changeset/itchy-seas-care.md diff --git a/.changeset/itchy-seas-care.md b/.changeset/itchy-seas-care.md new file mode 100644 index 0000000000..dacfed0db0 --- /dev/null +++ b/.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` diff --git a/lib/rules/function-no-unknown/__tests__/index.js b/lib/rules/function-no-unknown/__tests__/index.js index 3dab33c82e..4e62855a47 100644 --- a/lib/rules/function-no-unknown/__tests__/index.js +++ b/lib/rules/function-no-unknown/__tests__/index.js @@ -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: [ diff --git a/lib/rules/function-no-unknown/index.js b/lib/rules/function-no-unknown/index.js index 467a33a681..82a6699605 100644 --- a/lib/rules/function-no-unknown/index.js +++ b/lib/rules/function-no-unknown/index.js @@ -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;