Skip to content

Commit 33fcf78

Browse files
authored
Automate docs with eslint-doc-generator (#312)
1 parent b1d8da3 commit 33fcf78

31 files changed

+151
-338
lines changed

Diff for: README.md

+37-35
Original file line numberDiff line numberDiff line change
@@ -54,46 +54,48 @@ Here's an example ESLint configuration that:
5454

5555
## <a name='Rules'></a>Rules
5656

57-
* ✔️ if the rule belongs to the `recommended` configuration
58-
* 🛠 if some problems reported by the rule are automatically fixable by the `--fix` [command line](https://eslint.org/docs/user-guide/command-line-interface#fixing-problems) option
59-
* 💡 if some problems reported by the rule are manually fixable by editor [suggestions](https://eslint.org/docs/developer-guide/working-with-rules#providing-suggestions)
60-
61-
<!-- __BEGIN AUTOGENERATED TABLE__ -->
62-
Name | ✔️ | 🛠 | 💡 | Description
63-
----- | ----- | ----- | ----- | -----
64-
[consistent-output](https://github.com/eslint-community/eslint-plugin-eslint-plugin/blob/master/docs/rules/consistent-output.md) | ✔️ | | | enforce consistent use of `output` assertions in rule tests
65-
[fixer-return](https://github.com/eslint-community/eslint-plugin-eslint-plugin/blob/master/docs/rules/fixer-return.md) | ✔️ | | | require fixer functions to return a fix
66-
[meta-property-ordering](https://github.com/eslint-community/eslint-plugin-eslint-plugin/blob/master/docs/rules/meta-property-ordering.md) | | 🛠 | | enforce the order of meta properties
67-
[no-deprecated-context-methods](https://github.com/eslint-community/eslint-plugin-eslint-plugin/blob/master/docs/rules/no-deprecated-context-methods.md) | ✔️ | 🛠 | | disallow usage of deprecated methods on rule context objects
68-
[no-deprecated-report-api](https://github.com/eslint-community/eslint-plugin-eslint-plugin/blob/master/docs/rules/no-deprecated-report-api.md) | ✔️ | 🛠 | | disallow the version of `context.report()` with multiple arguments
69-
[no-identical-tests](https://github.com/eslint-community/eslint-plugin-eslint-plugin/blob/master/docs/rules/no-identical-tests.md) | ✔️ | 🛠 | | disallow identical tests
70-
[no-missing-message-ids](https://github.com/eslint-community/eslint-plugin-eslint-plugin/blob/master/docs/rules/no-missing-message-ids.md) | ✔️ | | | disallow `messageId`s that are missing from `meta.messages`
71-
[no-missing-placeholders](https://github.com/eslint-community/eslint-plugin-eslint-plugin/blob/master/docs/rules/no-missing-placeholders.md) | ✔️ | | | disallow missing placeholders in rule report messages
72-
[no-only-tests](https://github.com/eslint-community/eslint-plugin-eslint-plugin/blob/master/docs/rules/no-only-tests.md) | ✔️ | | 💡 | disallow the test case property `only`
73-
[no-unused-message-ids](https://github.com/eslint-community/eslint-plugin-eslint-plugin/blob/master/docs/rules/no-unused-message-ids.md) | ✔️ | | | disallow unused `messageId`s in `meta.messages`
74-
[no-unused-placeholders](https://github.com/eslint-community/eslint-plugin-eslint-plugin/blob/master/docs/rules/no-unused-placeholders.md) | ✔️ | | | disallow unused placeholders in rule report messages
75-
[no-useless-token-range](https://github.com/eslint-community/eslint-plugin-eslint-plugin/blob/master/docs/rules/no-useless-token-range.md) | ✔️ | 🛠 | | disallow unnecessary calls to `sourceCode.getFirstToken()` and `sourceCode.getLastToken()`
76-
[prefer-message-ids](https://github.com/eslint-community/eslint-plugin-eslint-plugin/blob/master/docs/rules/prefer-message-ids.md) | ✔️ | | | require using `messageId` instead of `message` to report rule violations
77-
[prefer-object-rule](https://github.com/eslint-community/eslint-plugin-eslint-plugin/blob/master/docs/rules/prefer-object-rule.md) | ✔️ | 🛠 | | disallow function-style rules
78-
[prefer-output-null](https://github.com/eslint-community/eslint-plugin-eslint-plugin/blob/master/docs/rules/prefer-output-null.md) | ✔️ | 🛠 | | disallow invalid RuleTester test cases where the `output` matches the `code`
79-
[prefer-placeholders](https://github.com/eslint-community/eslint-plugin-eslint-plugin/blob/master/docs/rules/prefer-placeholders.md) | | | | require using placeholders for dynamic report messages
80-
[prefer-replace-text](https://github.com/eslint-community/eslint-plugin-eslint-plugin/blob/master/docs/rules/prefer-replace-text.md) | | | | require using `replaceText()` instead of `replaceTextRange()`
81-
[report-message-format](https://github.com/eslint-community/eslint-plugin-eslint-plugin/blob/master/docs/rules/report-message-format.md) | | | | enforce a consistent format for rule report messages
82-
[require-meta-docs-description](https://github.com/eslint-community/eslint-plugin-eslint-plugin/blob/master/docs/rules/require-meta-docs-description.md) | | | | require rules to implement a `meta.docs.description` property with the correct format
83-
[require-meta-docs-url](https://github.com/eslint-community/eslint-plugin-eslint-plugin/blob/master/docs/rules/require-meta-docs-url.md) | | 🛠 | | require rules to implement a `meta.docs.url` property
84-
[require-meta-fixable](https://github.com/eslint-community/eslint-plugin-eslint-plugin/blob/master/docs/rules/require-meta-fixable.md) | ✔️ | | | require rules to implement a `meta.fixable` property
85-
[require-meta-has-suggestions](https://github.com/eslint-community/eslint-plugin-eslint-plugin/blob/master/docs/rules/require-meta-has-suggestions.md) | ✔️ | 🛠 | | require suggestable rules to implement a `meta.hasSuggestions` property
86-
[require-meta-schema](https://github.com/eslint-community/eslint-plugin-eslint-plugin/blob/master/docs/rules/require-meta-schema.md) | ✔️ | | 💡 | require rules to implement a `meta.schema` property
87-
[require-meta-type](https://github.com/eslint-community/eslint-plugin-eslint-plugin/blob/master/docs/rules/require-meta-type.md) | ✔️ | | | require rules to implement a `meta.type` property
88-
[test-case-property-ordering](https://github.com/eslint-community/eslint-plugin-eslint-plugin/blob/master/docs/rules/test-case-property-ordering.md) | | 🛠 | | require the properties of a test case to be placed in a consistent order
89-
[test-case-shorthand-strings](https://github.com/eslint-community/eslint-plugin-eslint-plugin/blob/master/docs/rules/test-case-shorthand-strings.md) | | 🛠 | | enforce consistent usage of shorthand strings for test cases with no options
90-
<!-- __END AUTOGENERATED TABLE__ -->
57+
<!-- begin rules list -->
58+
59+
✅ Enabled in the `recommended` configuration.\
60+
🔧 Automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/user-guide/command-line-interface#--fix).\
61+
💡 Manually fixable by [editor suggestions](https://eslint.org/docs/developer-guide/working-with-rules#providing-suggestions).
62+
63+
| Name | Description || 🔧 | 💡 |
64+
| :--------------------------------------------------------------------------- | :----------------------------------------------------------------------------------------- | :-- | :-- | :-- |
65+
| [consistent-output](docs/rules/consistent-output.md) | enforce consistent use of `output` assertions in rule tests || | |
66+
| [fixer-return](docs/rules/fixer-return.md) | require fixer functions to return a fix || | |
67+
| [meta-property-ordering](docs/rules/meta-property-ordering.md) | enforce the order of meta properties | | 🔧 | |
68+
| [no-deprecated-context-methods](docs/rules/no-deprecated-context-methods.md) | disallow usage of deprecated methods on rule context objects || 🔧 | |
69+
| [no-deprecated-report-api](docs/rules/no-deprecated-report-api.md) | disallow the version of `context.report()` with multiple arguments || 🔧 | |
70+
| [no-identical-tests](docs/rules/no-identical-tests.md) | disallow identical tests || 🔧 | |
71+
| [no-missing-message-ids](docs/rules/no-missing-message-ids.md) | disallow `messageId`s that are missing from `meta.messages` || | |
72+
| [no-missing-placeholders](docs/rules/no-missing-placeholders.md) | disallow missing placeholders in rule report messages || | |
73+
| [no-only-tests](docs/rules/no-only-tests.md) | disallow the test case property `only` || | 💡 |
74+
| [no-unused-message-ids](docs/rules/no-unused-message-ids.md) | disallow unused `messageId`s in `meta.messages` || | |
75+
| [no-unused-placeholders](docs/rules/no-unused-placeholders.md) | disallow unused placeholders in rule report messages || | |
76+
| [no-useless-token-range](docs/rules/no-useless-token-range.md) | disallow unnecessary calls to `sourceCode.getFirstToken()` and `sourceCode.getLastToken()` || 🔧 | |
77+
| [prefer-message-ids](docs/rules/prefer-message-ids.md) | require using `messageId` instead of `message` to report rule violations || | |
78+
| [prefer-object-rule](docs/rules/prefer-object-rule.md) | disallow function-style rules || 🔧 | |
79+
| [prefer-output-null](docs/rules/prefer-output-null.md) | disallow invalid RuleTester test cases where the `output` matches the `code` || 🔧 | |
80+
| [prefer-placeholders](docs/rules/prefer-placeholders.md) | require using placeholders for dynamic report messages | | | |
81+
| [prefer-replace-text](docs/rules/prefer-replace-text.md) | require using `replaceText()` instead of `replaceTextRange()` | | | |
82+
| [report-message-format](docs/rules/report-message-format.md) | enforce a consistent format for rule report messages | | | |
83+
| [require-meta-docs-description](docs/rules/require-meta-docs-description.md) | require rules to implement a `meta.docs.description` property with the correct format | | | |
84+
| [require-meta-docs-url](docs/rules/require-meta-docs-url.md) | require rules to implement a `meta.docs.url` property | | 🔧 | |
85+
| [require-meta-fixable](docs/rules/require-meta-fixable.md) | require rules to implement a `meta.fixable` property || | |
86+
| [require-meta-has-suggestions](docs/rules/require-meta-has-suggestions.md) | require suggestable rules to implement a `meta.hasSuggestions` property || 🔧 | |
87+
| [require-meta-schema](docs/rules/require-meta-schema.md) | require rules to implement a `meta.schema` property || | 💡 |
88+
| [require-meta-type](docs/rules/require-meta-type.md) | require rules to implement a `meta.type` property || | |
89+
| [test-case-property-ordering](docs/rules/test-case-property-ordering.md) | require the properties of a test case to be placed in a consistent order | | 🔧 | |
90+
| [test-case-shorthand-strings](docs/rules/test-case-shorthand-strings.md) | enforce consistent usage of shorthand strings for test cases with no options | | 🔧 | |
91+
92+
<!-- end rules list -->
9193

9294
## <a name='Presets'></a>Presets
9395

9496
| | Name | Description |
9597
|:--|:-----|:------------|
96-
| ✔️ | `recommended` | enables all recommended rules in this plugin |
98+
| | `recommended` | enables all recommended rules in this plugin |
9799
| | `rules-recommended` | enables all recommended rules that are aimed at linting ESLint rule files |
98100
| | `tests-recommended` | enables all recommended rules that are aimed at linting ESLint test files |
99101
| | `all` | enables all rules in this plugin |

Diff for: build/generate-readme-table.js

-61
This file was deleted.

Diff for: docs/rules/consistent-output.md

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
# Enforce consistent use of `output` assertions in rule tests (consistent-output)
1+
# Enforce consistent use of `output` assertions in rule tests (`eslint-plugin/consistent-output`)
22

3-
✔️ The `"extends": "plugin:eslint-plugin/recommended"` property in a configuration file enables this rule.
3+
✅ This rule is enabled in the `recommended` config.
4+
5+
<!-- end rule header -->
46

57
When writing tests for fixable rules, the `output` property on each test case can be used to assert what autofixed code is produced, or to assert that no autofix is produced using `output: null`.
68

Diff for: docs/rules/fixer-return.md

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
# Require fixer functions to return a fix (fixer-return)
1+
# Require fixer functions to return a fix (`eslint-plugin/fixer-return`)
22

3-
✔️ The `"extends": "plugin:eslint-plugin/recommended"` property in a configuration file enables this rule.
3+
✅ This rule is enabled in the `recommended` config.
4+
5+
<!-- end rule header -->
46

57
In a [fixable](https://eslint.org/docs/developer-guide/working-with-rules#applying-fixes) rule, a fixer function is useless if it never returns anything.
68

Diff for: docs/rules/meta-property-ordering.md

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
# Enforce the order of meta properties (meta-property-ordering)
1+
# Enforce the order of meta properties (`eslint-plugin/meta-property-ordering`)
22

3-
⚒️ The `--fix` option on the [command line](https://eslint.org/docs/user-guide/command-line-interface#--fix) can automatically fix some of the problems reported by this rule.
3+
🔧 This rule is automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix).
4+
5+
<!-- end rule header -->
46

57
This rule enforces that meta properties of a rule are placed in a consistent order.
68

Diff for: docs/rules/no-deprecated-context-methods.md

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1-
# Disallow usage of deprecated methods on rule context objects (no-deprecated-context-methods)
1+
# Disallow usage of deprecated methods on rule context objects (`eslint-plugin/no-deprecated-context-methods`)
22

3-
✔️ The `"extends": "plugin:eslint-plugin/recommended"` property in a configuration file enables this rule.
3+
✅ This rule is enabled in the `recommended` config.
44

5-
⚒️ The `--fix` option on the [command line](https://eslint.org/docs/user-guide/command-line-interface#--fix) can automatically fix some of the problems reported by this rule.
5+
🔧 This rule is automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix).
6+
7+
<!-- end rule header -->
68

79
This rule disallows the use of deprecated methods on rule `context` objects.
810

Diff for: docs/rules/no-deprecated-report-api.md

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1-
# Disallow the version of `context.report()` with multiple arguments (no-deprecated-report-api)
1+
# Disallow the version of `context.report()` with multiple arguments (`eslint-plugin/no-deprecated-report-api`)
22

3-
✔️ The `"extends": "plugin:eslint-plugin/recommended"` property in a configuration file enables this rule.
3+
✅ This rule is enabled in the `recommended` config.
44

5-
⚒️ The `--fix` option on the [command line](https://eslint.org/docs/user-guide/command-line-interface#--fix) can automatically fix some of the problems reported by this rule.
5+
🔧 This rule is automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix).
6+
7+
<!-- end rule header -->
68

79
ESLint has two APIs that rules can use to report problems.
810

Diff for: docs/rules/no-identical-tests.md

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1-
# Disallow identical tests (no-identical-tests)
1+
# Disallow identical tests (`eslint-plugin/no-identical-tests`)
22

3-
✔️ The `"extends": "plugin:eslint-plugin/recommended"` property in a configuration file enables this rule.
3+
✅ This rule is enabled in the `recommended` config.
44

5-
⚒️ The `--fix` option on the [command line](https://eslint.org/docs/user-guide/command-line-interface#--fix) can automatically fix some of the problems reported by this rule.
5+
🔧 This rule is automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix).
6+
7+
<!-- end rule header -->
68

79
Duplicate test cases can cause confusion, can be hard to detect manually in a long file, and serve no purpose.
810

Diff for: docs/rules/no-missing-message-ids.md

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
# Disallow `messageId`s that are missing from `meta.messages` (no-missing-message-ids)
1+
# Disallow `messageId`s that are missing from `meta.messages` (`eslint-plugin/no-missing-message-ids`)
22

3-
✔️ The `"extends": "plugin:eslint-plugin/recommended"` property in a configuration file enables this rule.
3+
✅ This rule is enabled in the `recommended` config.
4+
5+
<!-- end rule header -->
46

57
When using `meta.messages` and `messageId` to report rule violations, it's possible to mistakenly use a `messageId` that doesn't exist in `meta.messages`.
68

Diff for: docs/rules/no-missing-placeholders.md

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
# Disallow missing placeholders in rule report messages (no-missing-placeholders)
1+
# Disallow missing placeholders in rule report messages (`eslint-plugin/no-missing-placeholders`)
22

3-
✔️ The `"extends": "plugin:eslint-plugin/recommended"` property in a configuration file enables this rule.
3+
✅ This rule is enabled in the `recommended` config.
4+
5+
<!-- end rule header -->
46

57
Report messages in rules can have placeholders surrounded by curly brackets.
68

0 commit comments

Comments
 (0)