Skip to content

Commit

Permalink
Increase experimental messageArgs support (#6463)
Browse files Browse the repository at this point in the history
  • Loading branch information
chloerice committed Nov 11, 2022
1 parent 64b022a commit e65d244
Show file tree
Hide file tree
Showing 11 changed files with 25 additions and 5 deletions.
5 changes: 5 additions & 0 deletions .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`
2 changes: 2 additions & 0 deletions lib/rules/at-rule-disallowed-list/README.md
Expand Up @@ -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"`
Expand Down
3 changes: 2 additions & 1 deletion lib/rules/at-rule-disallowed-list/index.js
Expand Up @@ -43,7 +43,8 @@ const rule = (primary) => {
}

report({
message: messages.rejected(name),
message: messages.rejected,
messageArgs: [name],
node: atRule,
result,
ruleName,
Expand Down
2 changes: 2 additions & 0 deletions lib/rules/declaration-property-unit-disallowed-list/README.md
Expand Up @@ -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" }`
Expand Down
3 changes: 2 additions & 1 deletion lib/rules/declaration-property-unit-disallowed-list/index.js
Expand Up @@ -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,
Expand Down
Expand Up @@ -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/ }`
Expand Down
Expand Up @@ -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,
Expand Down
2 changes: 2 additions & 0 deletions lib/rules/function-disallowed-list/README.md
Expand Up @@ -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/`
Expand Down
3 changes: 2 additions & 1 deletion lib/rules/function-disallowed-list/index.js
Expand Up @@ -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,
Expand Down
2 changes: 2 additions & 0 deletions lib/rules/property-disallowed-list/README.md
Expand Up @@ -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/`
Expand Down
3 changes: 2 additions & 1 deletion lib/rules/property-disallowed-list/index.js
Expand Up @@ -48,7 +48,8 @@ const rule = (primary) => {
}

report({
message: messages.rejected(prop),
message: messages.rejected,
messageArgs: [prop],
word: prop,
node: decl,
result,
Expand Down

0 comments on commit e65d244

Please sign in to comment.