Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix function-no-unknown false positives for SCSS functions with namespace #6921

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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