diff --git a/.changeset/several-cucumbers-wonder.md b/.changeset/several-cucumbers-wonder.md new file mode 100644 index 0000000000..2bf3bc64a2 --- /dev/null +++ b/.changeset/several-cucumbers-wonder.md @@ -0,0 +1,5 @@ +--- +"stylelint": minor +--- + +Added: custom message formatting for `at-rule-disallowed-list`, `declaration-property-unit-disallowed-list`, `declaration-property-value-disallowed-list`, `function-disallowed-list`, and `property-disallowed-list` diff --git a/lib/rules/at-rule-disallowed-list/README.md b/lib/rules/at-rule-disallowed-list/README.md index 1c979e20d9..efdd373286 100644 --- a/lib/rules/at-rule-disallowed-list/README.md +++ b/lib/rules/at-rule-disallowed-list/README.md @@ -9,6 +9,8 @@ Specify a list of disallowed at-rules. * At-rules like this */ ``` +The [`message` secondary option](../../../docs/user-guide/configure.md#message) can accept the arguments of this rule. + ## Options `array|string`: `["array", "of", "unprefixed", "at-rules"]|"at-rule"` diff --git a/lib/rules/at-rule-disallowed-list/index.js b/lib/rules/at-rule-disallowed-list/index.js index 8b70c0a980..a59a74289f 100644 --- a/lib/rules/at-rule-disallowed-list/index.js +++ b/lib/rules/at-rule-disallowed-list/index.js @@ -43,7 +43,8 @@ const rule = (primary) => { } report({ - message: messages.rejected(name), + message: messages.rejected, + messageArgs: [name], node: atRule, result, ruleName, diff --git a/lib/rules/declaration-property-unit-disallowed-list/README.md b/lib/rules/declaration-property-unit-disallowed-list/README.md index f85e11310d..baeb31560c 100644 --- a/lib/rules/declaration-property-unit-disallowed-list/README.md +++ b/lib/rules/declaration-property-unit-disallowed-list/README.md @@ -9,6 +9,8 @@ a { width: 100px; } * These properties and these units */ ``` +The [`message` secondary option](../../../docs/user-guide/configure.md#message) can accept the arguments of this rule. + ## Options `object`: `{ "unprefixed-property-name": ["array", "of", "units"]|"unit" }` diff --git a/lib/rules/declaration-property-unit-disallowed-list/index.js b/lib/rules/declaration-property-unit-disallowed-list/index.js index 524a1e1eb2..c7c8b706a3 100644 --- a/lib/rules/declaration-property-unit-disallowed-list/index.js +++ b/lib/rules/declaration-property-unit-disallowed-list/index.js @@ -75,7 +75,8 @@ const rule = (primary) => { const endIndex = index + node.value.length; report({ - message: messages.rejected(prop, unit), + message: messages.rejected, + messageArgs: [prop, unit], node: decl, index, endIndex, diff --git a/lib/rules/declaration-property-value-disallowed-list/README.md b/lib/rules/declaration-property-value-disallowed-list/README.md index 9f16fdc823..84ae39d0b8 100644 --- a/lib/rules/declaration-property-value-disallowed-list/README.md +++ b/lib/rules/declaration-property-value-disallowed-list/README.md @@ -9,6 +9,8 @@ a { text-transform: uppercase; } * These properties and these values */ ``` +The [`message` secondary option](../../../docs/user-guide/configure.md#message) can accept the arguments of this rule. + ## Options `object`: `{ "unprefixed-property-name": ["array", "of", "values", "/regex/", /regex/]|"value"|"/regex/"|/regex/ }` diff --git a/lib/rules/declaration-property-value-disallowed-list/index.js b/lib/rules/declaration-property-value-disallowed-list/index.js index 84a0178f72..b7bd7439db 100644 --- a/lib/rules/declaration-property-value-disallowed-list/index.js +++ b/lib/rules/declaration-property-value-disallowed-list/index.js @@ -52,7 +52,8 @@ const rule = (primary) => { const endIndex = index + decl.value.length; report({ - message: messages.rejected(prop, value), + message: messages.rejected, + messageArgs: [prop, value], node: decl, index, endIndex, diff --git a/lib/rules/function-disallowed-list/README.md b/lib/rules/function-disallowed-list/README.md index 5b577eda82..23e21c5b71 100644 --- a/lib/rules/function-disallowed-list/README.md +++ b/lib/rules/function-disallowed-list/README.md @@ -9,6 +9,8 @@ a { transform: scale(1); } * This function */ ``` +The [`message` secondary option](../../../docs/user-guide/configure.md#message) can accept the arguments of this rule. + ## Options `array|string|regex`: `["array", "of", "unprefixed", /functions/, "regex"]|"function"|"/regex/"|/regex/` diff --git a/lib/rules/function-disallowed-list/index.js b/lib/rules/function-disallowed-list/index.js index 394858639e..fa8c7f249d 100644 --- a/lib/rules/function-disallowed-list/index.js +++ b/lib/rules/function-disallowed-list/index.js @@ -50,7 +50,8 @@ const rule = (primary) => { const endIndex = index + node.value.length; report({ - message: messages.rejected(node.value), + message: messages.rejected, + messageArgs: [node.value], node: decl, index, endIndex, diff --git a/lib/rules/property-disallowed-list/README.md b/lib/rules/property-disallowed-list/README.md index c5da123ef3..d0c95efcdd 100644 --- a/lib/rules/property-disallowed-list/README.md +++ b/lib/rules/property-disallowed-list/README.md @@ -9,6 +9,8 @@ a { text-rendering: optimizeLegibility; } * This property */ ``` +The [`message` secondary option](../../../docs/user-guide/configure.md#message) can accept the arguments of this rule. + ## Options `array|string|regex`: `["array", "of", /properties/, "regex"]|"property"|"/regex/"|/regex/` diff --git a/lib/rules/property-disallowed-list/index.js b/lib/rules/property-disallowed-list/index.js index 535ae23c0f..f988278972 100644 --- a/lib/rules/property-disallowed-list/index.js +++ b/lib/rules/property-disallowed-list/index.js @@ -48,7 +48,8 @@ const rule = (primary) => { } report({ - message: messages.rejected(prop), + message: messages.rejected, + messageArgs: [prop], word: prop, node: decl, result,