Skip to content

Commit

Permalink
Merge branch 'main' into fix/extends-order
Browse files Browse the repository at this point in the history
  • Loading branch information
jeddy3 committed Feb 14, 2023
2 parents 2cec3ba + 38591f2 commit 4036c6b
Show file tree
Hide file tree
Showing 159 changed files with 427 additions and 202 deletions.
5 changes: 5 additions & 0 deletions .changeset/message-args.md
@@ -0,0 +1,5 @@
---
"stylelint": minor
---

Added: `messageArgs` to 76 rules
2 changes: 2 additions & 0 deletions lib/rules/alpha-value-notation/README.md
Expand Up @@ -11,6 +11,8 @@ Specify percentage or number notation for alpha-values.

The [`fix` option](../../../docs/user-guide/options.md#fix) can automatically fix all of the problems reported by this rule.

The [`message` secondary option](../../../docs/user-guide/configure.md#message) can accept the arguments of this rule.

## Options

`string`: `"number"|"percentage"`
Expand Down
3 changes: 2 additions & 1 deletion lib/rules/alpha-value-notation/index.js
Expand Up @@ -119,7 +119,8 @@ const rule = (primary, secondaryOptions, context) => {
const endIndex = index + alpha.value.length;

report({
message: messages.expected(unfixed, fixed),
message: messages.expected,
messageArgs: [unfixed, fixed],
node: decl,
index,
endIndex,
Expand Down
2 changes: 2 additions & 0 deletions lib/rules/annotation-no-unknown/README.md
Expand Up @@ -11,6 +11,8 @@ a { color: green !imprtant; }

This rule considers annotations defined in the CSS Specifications, up to and including Editor's Drafts, to be known.

The [`message` secondary option](../../../docs/user-guide/configure.md#message) can accept the arguments of this rule.

## Options

### `true`
Expand Down
3 changes: 2 additions & 1 deletion lib/rules/annotation-no-unknown/index.js
Expand Up @@ -62,7 +62,8 @@ const rule = (primary, secondaryOptions) => {
}

report({
message: messages.rejected(value),
message: messages.rejected,
messageArgs: [value],
node: decl,
result,
ruleName,
Expand Down
2 changes: 2 additions & 0 deletions lib/rules/at-rule-allowed-list/README.md
Expand Up @@ -9,6 +9,8 @@ Specify a list of allowed 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-allowed-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/at-rule-no-unknown/README.md
Expand Up @@ -11,6 +11,8 @@ Disallow unknown at-rules.

This rule considers at-rules defined in the CSS Specifications, up to and including Editor's Drafts, to be known.

The [`message` secondary option](../../../docs/user-guide/configure.md#message) can accept the arguments of this rule.

## Options

### `true`
Expand Down
3 changes: 2 additions & 1 deletion lib/rules/at-rule-no-unknown/index.js
Expand Up @@ -58,7 +58,8 @@ const rule = (primary, secondaryOptions) => {
const atName = `@${name}`;

report({
message: messages.rejected(atName),
message: messages.rejected,
messageArgs: [atName],
node: atRule,
ruleName,
result,
Expand Down
2 changes: 2 additions & 0 deletions lib/rules/at-rule-no-vendor-prefix/README.md
Expand Up @@ -13,6 +13,8 @@ This rule ignores non-standard vendor-prefixed at-rules that aren't handled by [

The [`fix` option](../../../docs/user-guide/options.md#fix) can automatically fix all of the problems reported by this rule. However, it will not remove duplicate at-rules produced when the prefixes are removed. You can use [Autoprefixer](https://github.com/postcss/autoprefixer) itself, with the [`add` option off and the `remove` option on](https://github.com/postcss/autoprefixer#options), in these situations.

The [`message` secondary option](../../../docs/user-guide/configure.md#message) can accept the arguments of this rule.

## Options

### `true`
Expand Down
3 changes: 2 additions & 1 deletion lib/rules/at-rule-no-vendor-prefix/index.js
Expand Up @@ -48,7 +48,8 @@ const rule = (primary, _secondary, context) => {
}

report({
message: messages.rejected(name),
message: messages.rejected,
messageArgs: [name],
node: atRule,
word: `@${name}`,
result,
Expand Down
2 changes: 2 additions & 0 deletions lib/rules/at-rule-property-required-list/README.md
Expand Up @@ -9,6 +9,8 @@ Specify a list of required properties for an at-rule.
* At-rule and required property names */
```

The [`message` secondary option](../../../docs/user-guide/configure.md#message) can accept the arguments of this rule.

## Options

`object`: `{ "at-rule-name": ["array", "of", "properties"]|"property" }`
Expand Down
8 changes: 4 additions & 4 deletions lib/rules/at-rule-property-required-list/__tests__/index.js
Expand Up @@ -40,7 +40,7 @@ testRule({
{
code: '@font-face { font-display: auto; }',
description: '@font-face with missing property',
message: messages.expected('font-family', 'font-face'),
message: messages.expected('font-face', 'font-family'),
line: 1,
column: 1,
endLine: 1,
Expand All @@ -49,7 +49,7 @@ testRule({
{
code: '@FONT-FACE { FONT-DISPLAY: AUTO; }',
description: '@font-face with missing property (case-sensitive)',
message: messages.expected('font-family', 'font-face'),
message: messages.expected('font-face', 'font-family'),
line: 1,
column: 1,
endLine: 1,
Expand All @@ -58,7 +58,7 @@ testRule({
{
code: "@font-face { font-family: 'Arvo'; font-weight: normal }",
description: '@font-face with missing property',
message: messages.expected('font-display', 'font-face'),
message: messages.expected('font-face', 'font-display'),
line: 1,
column: 1,
endLine: 1,
Expand All @@ -67,7 +67,7 @@ testRule({
{
code: '@page { padding: 0.5cm }',
description: '@page with missing property',
message: messages.expected('margin', 'page'),
message: messages.expected('page', 'margin'),
line: 1,
column: 1,
endLine: 1,
Expand Down
5 changes: 3 additions & 2 deletions lib/rules/at-rule-property-required-list/index.js
Expand Up @@ -11,7 +11,7 @@ const { isString } = require('../../utils/validateTypes');
const ruleName = 'at-rule-property-required-list';

const messages = ruleMessages(ruleName, {
expected: (property, atRule) => `Expected property "${property}" for at-rule "${atRule}"`,
expected: (atRule, property) => `Expected property "${property}" for at-rule "${atRule}"`,
});

const meta = {
Expand Down Expand Up @@ -55,7 +55,8 @@ const rule = (primary) => {
}

report({
message: messages.expected(propertyName, atRuleName),
message: messages.expected,
messageArgs: [atRuleName, propertyName],
node: atRule,
word: `@${atRule.name}`,
result,
Expand Down
2 changes: 2 additions & 0 deletions lib/rules/color-function-notation/README.md
Expand Up @@ -15,6 +15,8 @@ For legacy reasons, `rgb()` and `hsl()` also supports an alternate syntax that s

The [`fix` option](../../../docs/user-guide/options.md#fix) can automatically fix some of the problems reported by this rule when the primary option is `"modern"`.

The [`message` secondary option](../../../docs/user-guide/configure.md#message) can accept the arguments of this rule.

## Options

`string`: `"modern"|"legacy"`
Expand Down
3 changes: 2 additions & 1 deletion lib/rules/color-function-notation/index.js
Expand Up @@ -88,7 +88,8 @@ const rule = (primary, _secondaryOptions, context) => {
const endIndex = index + (sourceEndIndex - sourceIndex);

report({
message: messages.expected(primary),
message: messages.expected,
messageArgs: [primary],
node: decl,
index,
endIndex,
Expand Down
2 changes: 2 additions & 0 deletions lib/rules/color-hex-alpha/README.md
Expand Up @@ -9,6 +9,8 @@ a { color: #fffa }
* This alpha channel */
```

The [`message` secondary option](../../../docs/user-guide/configure.md#message) can accept the arguments of this rule.

## Options

`string`: `"always"|"never"`
Expand Down
3 changes: 2 additions & 1 deletion lib/rules/color-hex-alpha/index.js
Expand Up @@ -47,7 +47,8 @@ const rule = (primary) => {
const endIndex = index + value.length;

report({
message: primary === 'never' ? messages.unexpected(value) : messages.expected(value),
message: primary === 'never' ? messages.unexpected : messages.expected,
messageArgs: [value],
node: decl,
index,
endIndex,
Expand Down
2 changes: 2 additions & 0 deletions lib/rules/color-hex-length/README.md
Expand Up @@ -11,6 +11,8 @@ a { color: #fff }

The [`fix` option](../../../docs/user-guide/options.md#fix) can automatically fix all of the problems reported by this rule.

The [`message` secondary option](../../../docs/user-guide/configure.md#message) can accept the arguments of this rule.

## Options

`string`: `"short"|"long"`
Expand Down
3 changes: 2 additions & 1 deletion lib/rules/color-hex-length/index.js
Expand Up @@ -68,7 +68,8 @@ const rule = (primary, _secondaryOptions, context) => {
const endIndex = index + node.value.length;

report({
message: messages.expected(hexValue, expectedHex),
message: messages.expected,
messageArgs: [hexValue, expectedHex],
node: decl,
index,
endIndex,
Expand Down
2 changes: 2 additions & 0 deletions lib/rules/color-no-invalid-hex/README.md
Expand Up @@ -11,6 +11,8 @@ a { color: #y3 }

Longhand hex colors can be either 6 or 8 (with alpha channel) hexadecimal characters. And their shorthand variants are 3 and 4 characters respectively.

The [`message` secondary option](../../../docs/user-guide/configure.md#message) can accept the arguments of this rule.

## Options

### `true`
Expand Down
3 changes: 2 additions & 1 deletion lib/rules/color-no-invalid-hex/index.js
Expand Up @@ -49,7 +49,8 @@ const rule = (primary) => {
const endIndex = index + hexValue.length;

report({
message: messages.rejected(hexValue),
message: messages.rejected,
messageArgs: [hexValue],
node: decl,
index,
endIndex,
Expand Down
2 changes: 2 additions & 0 deletions lib/rules/comment-pattern/README.md
Expand Up @@ -9,6 +9,8 @@ Specify a pattern for comments.
* The pattern of this */
```

The [`message` secondary option](../../../docs/user-guide/configure.md#message) can accept the arguments of this rule.

## Options

`regex|string`
Expand Down
3 changes: 2 additions & 1 deletion lib/rules/comment-pattern/index.js
Expand Up @@ -37,7 +37,8 @@ const rule = (primary) => {
}

report({
message: messages.expected(primary),
message: messages.expected,
messageArgs: [primary],
node: comment,
result,
ruleName,
Expand Down
2 changes: 2 additions & 0 deletions lib/rules/comment-word-disallowed-list/README.md
Expand Up @@ -11,6 +11,8 @@ Specify a list of disallowed words within comments.

**Caveat:** Comments within _selector and value lists_ are currently ignored.

The [`message` secondary option](../../../docs/user-guide/configure.md#message) can accept the arguments of this rule.

## Options

`array|string|regexp`: `["array", "of", "words", /or/, "/regex/"]|"word"|"/regex/"|/regex/`
Expand Down
3 changes: 2 additions & 1 deletion lib/rules/comment-word-disallowed-list/index.js
Expand Up @@ -46,7 +46,8 @@ const rule = (primary) => {
}

report({
message: messages.rejected(matchesWord.pattern),
message: messages.rejected,
messageArgs: [matchesWord.pattern],
node: comment,
word: matchesWord.substring,
result,
Expand Down
2 changes: 2 additions & 0 deletions lib/rules/custom-property-no-missing-var-function/README.md
Expand Up @@ -12,6 +12,8 @@ Disallow missing `var` function for custom properties.

This rule only reports custom properties that are defined within the same source.

The [`message` secondary option](../../../docs/user-guide/configure.md#message) can accept the arguments of this rule.

## Options

### `true`
Expand Down
3 changes: 2 additions & 1 deletion lib/rules/custom-property-no-missing-var-function/index.js
Expand Up @@ -51,7 +51,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
Expand Up @@ -11,6 +11,8 @@ a { --custom-property: pink; --custom-property: orange; }

This rule is case-sensitive.

The [`message` secondary option](../../../docs/user-guide/configure.md#message) can accept the arguments of this rule.

## Options

### `true`
Expand Down
Expand Up @@ -44,7 +44,8 @@ const rule = (primary) => {

if (isDuplicate) {
report({
message: messages.rejected(prop),
message: messages.rejected,
messageArgs: [prop],
node: decl,
result,
ruleName,
Expand Down
2 changes: 2 additions & 0 deletions lib/rules/declaration-block-no-duplicate-properties/README.md
Expand Up @@ -13,6 +13,8 @@ This rule ignores variables (`$sass`, `@less`, `--custom-property`).

The [`fix` option](../../../docs/user-guide/options.md#fix) can automatically fix all of the problems reported by this rule.

The [`message` secondary option](../../../docs/user-guide/configure.md#message) can accept the arguments of this rule.

## Options

### `true`
Expand Down
6 changes: 4 additions & 2 deletions lib/rules/declaration-block-no-duplicate-properties/index.js
Expand Up @@ -108,7 +108,8 @@ const rule = (primary, secondaryOptions, context) => {
const fixOrReport = () => {
if (!context.fix) {
return report({
message: messages.rejected(prop),
message: messages.rejected,
messageArgs: [prop],
node: decl,
result,
ruleName,
Expand Down Expand Up @@ -140,7 +141,8 @@ const rule = (primary, secondaryOptions, context) => {
}

return report({
message: messages.rejected(prop),
message: messages.rejected,
messageArgs: [prop],
node: decl,
result,
ruleName,
Expand Down
Expand Up @@ -68,6 +68,8 @@ Flexbox-related properties can be ignored using `ignoreShorthands: ["/flex/"]` (

The [`fix` option](../../../docs/user-guide/options.md#fix) can automatically fix most of the problems reported by this rule.

The [`message` secondary option](../../../docs/user-guide/configure.md#message) can accept the arguments of this rule.

## Options

### `true`
Expand Down
Expand Up @@ -136,7 +136,8 @@ const rule = (primary, secondaryOptions, context) => {
result,
node: decl,
word: decl.prop,
message: messages.expected(prefixedShorthandProperty),
message: messages.expected,
messageArgs: [prefixedShorthandProperty],
});
}
});
Expand Down
Expand Up @@ -11,6 +11,8 @@ a { background-repeat: repeat; background: green; }

In almost every case, this is just an authorial oversight. For more about this behavior, see [MDN's documentation of shorthand properties](https://developer.mozilla.org/en-US/docs/Web/CSS/Shorthand_properties).

The [`message` secondary option](../../../docs/user-guide/configure.md#message) can accept the arguments of this rule.

## Options

### `true`
Expand Down
Expand Up @@ -56,7 +56,8 @@ const rule = (primary) => {
ruleName,
result,
node: decl,
message: messages.rejected(prop, declaration || ''),
message: messages.rejected,
messageArgs: [prop, declaration || ''],
word: prop,
});
}
Expand Down
Expand Up @@ -9,6 +9,8 @@ a { color: pink; top: 0; }
* The number of these declarations */
```

The [`message` secondary option](../../../docs/user-guide/configure.md#message) can accept the arguments of this rule.

## Options

`int`: Maximum number of declarations allowed.
Expand Down

0 comments on commit 4036c6b

Please sign in to comment.