Skip to content

Commit

Permalink
at-function-named-arguments: ignore Sass maps
Browse files Browse the repository at this point in the history
  • Loading branch information
kristerkari committed Apr 17, 2018
1 parent f5733b0 commit c172257
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# HEAD

- Fixed: `at-function-named-arguments` now ignores Sass maps.

# 3.0.0

- Removed: Node.JS 4.x support. Node.js 6.x or greater is now required (#213).
Expand Down
24 changes: 24 additions & 0 deletions src/rules/at-function-named-arguments/__tests__/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,30 @@ testRule(rule, {
}
`,
description: "Always. Example: single argument is an unquoted string."
},
{
code: `
$space-values: (
tiny: $horizontal-list-spacing-tiny,
small: $horizontal-list-spacing-small,
medium: $horizontal-list-spacing-medium,
large: $horizontal-list-spacing-large,
huge: $horizontal-list-spacing-huge
);
`,
description: "Always. Should ignore Sass maps."
},
{
code: `
$space-values: (
tiny: $horizontal-list-spacing-tiny,
small: $horizontal-list-spacing-small,
medium: $horizontal-list-spacing-medium,
large: $horizontal-list-spacing-large,
huge: $horizontal-list-spacing-huge
) !default;
`,
description: "Always. Should ignore Sass maps with default."
}
],

Expand Down
6 changes: 5 additions & 1 deletion src/rules/at-function-named-arguments/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,11 @@ export default function(expectation, options) {

root.walkDecls(decl => {
valueParser(decl.value).walk(node => {
if (node.type !== "function" || isNativeCssFunction(node.value)) {
if (
node.type !== "function" ||
isNativeCssFunction(node.value) ||
node.value === ""
) {
return;
}

Expand Down

0 comments on commit c172257

Please sign in to comment.