Skip to content

Commit

Permalink
Fix function-no-unknown false positives for SCSS functions with na…
Browse files Browse the repository at this point in the history
…mespace (#6921)
  • Loading branch information
romainmenke committed Jun 16, 2023
1 parent ffd3119 commit 1c44f18
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/brave-balloons-rescue.md
@@ -0,0 +1,5 @@
---
"stylelint": patch
---

Fixed: `function-no-unknown` false positives for SCSS functions with namespace
4 changes: 4 additions & 0 deletions lib/rules/function-no-unknown/__tests__/index.js
Expand Up @@ -28,6 +28,10 @@ testRule({
{
code: 'a { height: calc(10px*(5*(10 - 5))); }',
},
{
code: 'a { transform: color.adjust(1px); transform: rgb(color.adjust(1px)); }',
description: 'ignore scss namespaced functions',
},
],

reject: [
Expand Down
5 changes: 5 additions & 0 deletions lib/utils/isStandardSyntaxValue.js
Expand Up @@ -26,6 +26,11 @@ module.exports = function isStandardSyntaxValue(value) {
return false;
}

// SCSS namespace (example namespace.function-name())
if (/^.+\.[-\w]+\(/.test(value)) {
return false;
}

// Less variable
if (normalizedValue.startsWith('@')) {
return false;
Expand Down

0 comments on commit 1c44f18

Please sign in to comment.