diff --git a/CHANGELOG.md b/CHANGELOG.md index 8736a1af..32aac688 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +# HEAD + +- Fixed: `at-function-named-arguments` was not correctly handling functions inside Sass maps. + # 3.4.0 - Added: `at-mixin-argumentless-call-parentheses` autofix (#280). diff --git a/src/rules/at-function-named-arguments/__tests__/index.js b/src/rules/at-function-named-arguments/__tests__/index.js index 51196d62..27aeb846 100644 --- a/src/rules/at-function-named-arguments/__tests__/index.js +++ b/src/rules/at-function-named-arguments/__tests__/index.js @@ -1,4 +1,4 @@ -import rule, { ruleName, messages } from ".."; +import rule, { messages, ruleName } from ".."; // Required ("always") testRule(rule, { @@ -377,7 +377,19 @@ testRule(rule, { } `, description: - "Always. Example: native CSS function is ignored inside a function call." + "Never. Example: native CSS function is ignored inside a function call." + }, + { + code: ` + $color: #123456; + + $rgb: ( + "r": red($color), + "g": green($color), + "b": blue($color) + ); + `, + description: "Never. function call inside a map." } ], diff --git a/src/rules/at-function-named-arguments/index.js b/src/rules/at-function-named-arguments/index.js index 9e43ca0f..dd9d6a81 100644 --- a/src/rules/at-function-named-arguments/index.js +++ b/src/rules/at-function-named-arguments/index.js @@ -1,12 +1,12 @@ +import { isString } from "lodash"; +import valueParser from "postcss-value-parser"; import { utils } from "stylelint"; import { + isNativeCssFunction, namespace, optionsHaveIgnored, - isNativeCssFunction, parseFunctionArguments } from "../../utils"; -import { isString } from "lodash"; -import valueParser from "postcss-value-parser"; export const ruleName = namespace("at-function-named-arguments"); @@ -74,7 +74,7 @@ export default function(expectation, options) { return; } - const args = parseFunctionArguments(decl.value); + const args = parseFunctionArguments(valueParser.stringify(node)); const isSingleArgument = args.length === 1; if (isSingleArgument && shouldIgnoreSingleArgument) {