Skip to content

Commit

Permalink
better handling of function-no-unknown
Browse files Browse the repository at this point in the history
apply pr comments
  • Loading branch information
m4thieulavoie committed Feb 15, 2022
1 parent 42a401c commit a58f929
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/rules/function-no-unknown/__tests__/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ testRule({
{
code: 'a { $list: (list) }',
},
{
code: 'a { --primary-color: #{theme(1px)}; }',
},
],
});

Expand Down
6 changes: 6 additions & 0 deletions lib/utils/__tests__/isStandardSyntaxFunction.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ describe('isStandardSyntaxFunction', () => {
it('scss map', () => {
expect(isStandardSyntaxFunction(func('a { $map: (key: value) }'))).toBe(false);
});

it('scss function in custom prop', () => {
expect(isStandardSyntaxFunction(func('a { --primary-color: #{darken(#fff, 0.2)} }'))).toBe(
false,
);
});
});

function func(css) {
Expand Down
4 changes: 4 additions & 0 deletions lib/utils/isStandardSyntaxFunction.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,9 @@ module.exports = function (node) {
return false;
}

if (node.value.startsWith('#{')) {
return false;
}

return true;
};

0 comments on commit a58f929

Please sign in to comment.