From b4fd2d50f588c5c4adb7f63a1091393b427f1a13 Mon Sep 17 00:00:00 2001 From: Matt Wang Date: Mon, 9 Jan 2023 07:30:57 -0800 Subject: [PATCH] Add message arguments to `declaration-property-unit-allowed-list` (#6570) Closes #6454. --- .changeset/perfect-suits-unite.md | 5 +++++ lib/rules/declaration-property-unit-allowed-list/README.md | 2 ++ lib/rules/declaration-property-unit-allowed-list/index.js | 3 ++- 3 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 .changeset/perfect-suits-unite.md diff --git a/.changeset/perfect-suits-unite.md b/.changeset/perfect-suits-unite.md new file mode 100644 index 0000000000..2deaafea6e --- /dev/null +++ b/.changeset/perfect-suits-unite.md @@ -0,0 +1,5 @@ +--- +"stylelint": minor +--- + +Added: message arguments to `declaration-property-unit-allowed-list` diff --git a/lib/rules/declaration-property-unit-allowed-list/README.md b/lib/rules/declaration-property-unit-allowed-list/README.md index 035d657348..8dee2c66ba 100644 --- a/lib/rules/declaration-property-unit-allowed-list/README.md +++ b/lib/rules/declaration-property-unit-allowed-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-allowed-list/index.js b/lib/rules/declaration-property-unit-allowed-list/index.js index 7a75f91313..57a69d37aa 100644 --- a/lib/rules/declaration-property-unit-allowed-list/index.js +++ b/lib/rules/declaration-property-unit-allowed-list/index.js @@ -93,7 +93,8 @@ const rule = (primary, secondaryOptions) => { const endIndex = index + node.value.length; report({ - message: messages.rejected(prop, unit), + message: messages.rejected, + messageArgs: [prop, unit], node: decl, index, endIndex,