Skip to content

Commit

Permalink
Fix processing of less parametric mixins
Browse files Browse the repository at this point in the history
  • Loading branch information
immitsu committed Jun 18, 2021
1 parent 403248c commit 158e277
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/utils/__tests__/isStandardSyntaxRule.test.js
Expand Up @@ -79,6 +79,9 @@ describe('isStandardSyntaxRule', () => {
it('less guarded namespaces', () => {
expect(isStandardSyntaxRule(lessNode('#namespace when (@mode=huge) {}'))).toBeFalsy();
});
it('less parametric mixins', () => {
expect(isStandardSyntaxRule(lessNode('.mixin (@variable: 5) {}'))).toBeFalsy();
});
it('mixin guards', () => {
expect(
isStandardSyntaxRule(lessNode('.mixin (@variable) when (@variable = 10px) {}')),
Expand Down
5 changes: 5 additions & 0 deletions lib/utils/isStandardSyntaxRule.js
Expand Up @@ -60,6 +60,11 @@ module.exports = function (rule) {
return false;
}

// Less Parametric mixins (e.g. .mixin(@variable: x) {})
if (/\(@.*\)$/.test(selector)) {
return false;
}

// Ignore Scss nested properties
if (selector.endsWith(':')) {
return false;
Expand Down

0 comments on commit 158e277

Please sign in to comment.