Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add missing link about custom message option to rule docs #6475

Merged
merged 1 commit into from Nov 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
17 changes: 17 additions & 0 deletions lib/rules/__tests__/index.test.js
Expand Up @@ -31,3 +31,20 @@ describe('fixable rules', () => {
expect(rulesListDoc).toMatch(new RegExp(`^.+\\b${name}\\b.+\\(Autofixable\\)\\.$`, 'm'));
});
});

describe('custom message option', () => {
test.each(Object.keys(rules))(
'"%s" should describe a custom message option in the doc',
async (ruleName) => {
const jsFile = path.join(__dirname, '..', ruleName, 'index.js');
const jsCode = await fs.promises.readFile(jsFile, 'utf8');

// NOTE: If all rules support a custom message option, we should remove this `if` statement.
if (!jsCode.includes('\tmessageArgs: [')) return;

const doc = await fs.promises.readFile(jsFile.replace('index.js', 'README.md'), 'utf8');

expect(doc).toContain('`message` secondary option');
},
);
});
2 changes: 2 additions & 0 deletions lib/rules/custom-media-pattern/README.md
Expand Up @@ -9,6 +9,8 @@ Specify a pattern for custom media query names.
* 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
2 changes: 2 additions & 0 deletions lib/rules/custom-property-pattern/README.md
Expand Up @@ -9,6 +9,8 @@ a { --foo-: 1px; }
* 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
2 changes: 2 additions & 0 deletions lib/rules/keyframes-name-pattern/README.md
Expand Up @@ -9,6 +9,8 @@ Specify a pattern for keyframe names.
* 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
2 changes: 2 additions & 0 deletions lib/rules/selector-class-pattern/README.md
Expand Up @@ -13,6 +13,8 @@ This rule ignores non-outputting Less mixin definitions and called Less mixins.

Escaped selectors (e.g. `.u-size-11\/12\@sm`) are parsed as escaped twice (e.g. `.u-size-11\\/12\\@sm`). Your RegExp should account for that.

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

## Options

`regex|string`
Expand Down
2 changes: 2 additions & 0 deletions lib/rules/selector-id-pattern/README.md
Expand Up @@ -9,6 +9,8 @@ Specify a pattern for ID selectors.
* These ID selectors */
```

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

## Options

`regex|string`
Expand Down
2 changes: 2 additions & 0 deletions lib/rules/selector-nested-pattern/README.md
Expand Up @@ -14,6 +14,8 @@ Specify a pattern for the selectors of rules nested within rules.

Non-standard selectors (e.g. selectors with Sass or Less interpolation) and selectors of rules nested within at-rules are ignored.

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

## Options

`regex|string`
Expand Down