Skip to content

Commit 015c207

Browse files
chore: postprocess with prettier in eslint-doc-generator (#435)
1 parent d7331ca commit 015c207

24 files changed

+169
-162
lines changed

.eslint-doc-generatorrc.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
'use strict';
22

3+
const prettier = require('prettier');
4+
35
/** @type {import('eslint-doc-generator').GenerateOptions} */
46
module.exports = {
57
ignoreConfig: [
@@ -9,6 +11,11 @@ module.exports = {
911
'tests',
1012
'tests-recommended',
1113
],
14+
postprocess: async (content, path) =>
15+
prettier.format(content, {
16+
...(await prettier.resolveConfig(path)),
17+
parser: 'markdown',
18+
}),
1219
ruleDocSectionInclude: ['Rule Details'],
1320
ruleListSplit: 'meta.docs.category',
1421
urlConfigs:

README.md

Lines changed: 73 additions & 76 deletions
Large diffs are not rendered by default.

docs/rules/consistent-output.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@ new RuleTester().run('example-rule', rule, {
6666

6767
This rule takes an optional string enum option with one of the following values:
6868

69-
* `"consistent"` - (default) if any invalid test cases have output assertions, then all invalid test cases must have output assertions
70-
* `"always"` - always require invalid test cases to have output assertions
69+
- `"consistent"` - (default) if any invalid test cases have output assertions, then all invalid test cases must have output assertions
70+
- `"always"` - always require invalid test cases to have output assertions
7171

7272
## When Not To Use It
7373

@@ -77,4 +77,4 @@ As mentioned in the introduction, the need for this rule is reduced as of ESLint
7777

7878
## Further Reading
7979

80-
* [`RuleTester` documentation](http://eslint.org/docs/developer-guide/working-with-plugins#testing)
80+
- [`RuleTester` documentation](http://eslint.org/docs/developer-guide/working-with-plugins#testing)

docs/rules/meta-property-ordering.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ This rule enforces that meta properties of a rule are placed in a consistent ord
1212

1313
This rule has an array option:
1414

15-
* `['type', 'docs', 'fixable', 'hasSuggestions', 'schema', 'messages', 'deprecated', 'replacedBy']` (default): The order that the properties of `meta` should be placed in.
15+
- `['type', 'docs', 'fixable', 'hasSuggestions', 'schema', 'messages', 'deprecated', 'replacedBy']` (default): The order that the properties of `meta` should be placed in.
1616

1717
Examples of **incorrect** code for this rule:
1818

docs/rules/no-deprecated-context-methods.md

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -10,26 +10,26 @@ This rule disallows the use of deprecated methods on rule `context` objects.
1010

1111
The deprecated methods are:
1212

13-
* `getSource`
14-
* `getSourceLines`
15-
* `getAllComments`
16-
* `getNodeByRangeIndex`
17-
* `getComments`
18-
* `getCommentsBefore`
19-
* `getCommentsAfter`
20-
* `getCommentsInside`
21-
* `getJSDocComment`
22-
* `getFirstToken`
23-
* `getFirstTokens`
24-
* `getLastToken`
25-
* `getLastTokens`
26-
* `getTokenAfter`
27-
* `getTokenBefore`
28-
* `getTokenByRangeStart`
29-
* `getTokens`
30-
* `getTokensAfter`
31-
* `getTokensBefore`
32-
* `getTokensBetween`
13+
- `getSource`
14+
- `getSourceLines`
15+
- `getAllComments`
16+
- `getNodeByRangeIndex`
17+
- `getComments`
18+
- `getCommentsBefore`
19+
- `getCommentsAfter`
20+
- `getCommentsInside`
21+
- `getJSDocComment`
22+
- `getFirstToken`
23+
- `getFirstTokens`
24+
- `getLastToken`
25+
- `getLastTokens`
26+
- `getTokenAfter`
27+
- `getTokenBefore`
28+
- `getTokenByRangeStart`
29+
- `getTokens`
30+
- `getTokensAfter`
31+
- `getTokensBefore`
32+
- `getTokensBetween`
3333

3434
Instead of using these methods, you should use the equivalent methods on [`SourceCode`](https://eslint.org/docs/developer-guide/working-with-rules#contextgetsourcecode), e.g. `context.getSourceCode().getText()` instead of `context.getSource()`.
3535

@@ -71,4 +71,4 @@ If you need to support very old versions of ESLint where `SourceCode` doesn't ex
7171

7272
## Further Reading
7373

74-
* [`SourceCode` API](https://eslint.org/docs/developer-guide/working-with-rules#contextgetsourcecode)
74+
- [`SourceCode` API](https://eslint.org/docs/developer-guide/working-with-rules#contextgetsourcecode)

docs/rules/no-deprecated-report-api.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88

99
ESLint has two APIs that rules can use to report problems.
1010

11-
* The [deprecated API](http://eslint.org/docs/developer-guide/working-with-rules-deprecated) accepts multiple arguments: `context.report(node, [loc], message)`.
12-
* The ["new API"](http://eslint.org/docs/developer-guide/working-with-rules#contextreport) accepts a single argument: an object containing information about the reported problem.
11+
- The [deprecated API](http://eslint.org/docs/developer-guide/working-with-rules-deprecated) accepts multiple arguments: `context.report(node, [loc], message)`.
12+
- The ["new API"](http://eslint.org/docs/developer-guide/working-with-rules#contextreport) accepts a single argument: an object containing information about the reported problem.
1313

1414
It is recommended that all rules use the new API.
1515

@@ -41,5 +41,5 @@ module.exports = {
4141

4242
## Further Reading
4343

44-
* [Deprecated rule API](http://eslint.org/docs/developer-guide/working-with-rules-deprecated)
45-
* [New rule API](http://eslint.org/docs/developer-guide/working-with-rules)
44+
- [Deprecated rule API](http://eslint.org/docs/developer-guide/working-with-rules-deprecated)
45+
- [New rule API](http://eslint.org/docs/developer-guide/working-with-rules)

docs/rules/no-missing-message-ids.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,6 @@ module.exports = {
5858

5959
## Further Reading
6060

61-
* [messageIds API](https://eslint.org/docs/developer-guide/working-with-rules#messageids)
62-
* [no-unused-message-ids](./no-unused-message-ids.md) rule
63-
* [prefer-message-ids](./prefer-message-ids.md) rule
61+
- [messageIds API](https://eslint.org/docs/developer-guide/working-with-rules#messageids)
62+
- [no-unused-message-ids](./no-unused-message-ids.md) rule
63+
- [prefer-message-ids](./prefer-message-ids.md) rule

docs/rules/no-missing-placeholders.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,4 +74,4 @@ If you want to use rule messages that actually contain double-curly bracket text
7474

7575
## Further Reading
7676

77-
* [context.report() API](http://eslint.org/docs/developer-guide/working-with-rules#contextreport)
77+
- [context.report() API](http://eslint.org/docs/developer-guide/working-with-rules#contextreport)

docs/rules/no-unused-message-ids.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,6 @@ module.exports = {
5959

6060
## Further Reading
6161

62-
* [messageIds API](https://eslint.org/docs/developer-guide/working-with-rules#messageids)
63-
* [no-missing-message-ids](./no-missing-message-ids.md) rule
64-
* [prefer-message-ids](./prefer-message-ids.md) rule
62+
- [messageIds API](https://eslint.org/docs/developer-guide/working-with-rules#messageids)
63+
- [no-missing-message-ids](./no-missing-message-ids.md) rule
64+
- [prefer-message-ids](./prefer-message-ids.md) rule

docs/rules/no-unused-placeholders.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,5 +57,5 @@ If you want to allow unused placeholders, you should turn off this rule.
5757

5858
## Further Reading
5959

60-
* [context.report() API](http://eslint.org/docs/developer-guide/working-with-rules#contextreport)
61-
* [no-missing-placeholders](https://github.com/eslint-community/eslint-plugin-eslint-plugin/blob/master/docs/rules/no-missing-placeholders.md)
60+
- [context.report() API](http://eslint.org/docs/developer-guide/working-with-rules#contextreport)
61+
- [no-missing-placeholders](https://github.com/eslint-community/eslint-plugin-eslint-plugin/blob/master/docs/rules/no-missing-placeholders.md)

0 commit comments

Comments
 (0)