Skip to content

docs: automate docs with eslint-doc-generator #312

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

Merged
merged 1 commit into from
Oct 13, 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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 37 additions & 35 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,46 +54,48 @@ Here's an example ESLint configuration that:

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

* ✔️ if the rule belongs to the `recommended` configuration
* 🛠 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
* 💡 if some problems reported by the rule are manually fixable by editor [suggestions](https://eslint.org/docs/developer-guide/working-with-rules#providing-suggestions)

<!-- __BEGIN AUTOGENERATED TABLE__ -->
Name | ✔️ | 🛠 | 💡 | Description
----- | ----- | ----- | ----- | -----
[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
[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
[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
[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
[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
[no-identical-tests](https://github.com/eslint-community/eslint-plugin-eslint-plugin/blob/master/docs/rules/no-identical-tests.md) | ✔️ | 🛠 | | disallow identical tests
[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`
[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
[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`
[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`
[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
[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()`
[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
[prefer-object-rule](https://github.com/eslint-community/eslint-plugin-eslint-plugin/blob/master/docs/rules/prefer-object-rule.md) | ✔️ | 🛠 | | disallow function-style rules
[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`
[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
[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()`
[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
[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
[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
[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
[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
[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
[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
[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
[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
<!-- __END AUTOGENERATED TABLE__ -->
<!-- begin rules list -->

✅ Enabled in the `recommended` configuration.\
🔧 Automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/user-guide/command-line-interface#--fix).\
💡 Manually fixable by [editor suggestions](https://eslint.org/docs/developer-guide/working-with-rules#providing-suggestions).

| Name | Description | ✅ | 🔧 | 💡 |
| :--------------------------------------------------------------------------- | :----------------------------------------------------------------------------------------- | :-- | :-- | :-- |
| [consistent-output](docs/rules/consistent-output.md) | enforce consistent use of `output` assertions in rule tests | ✅ | | |
| [fixer-return](docs/rules/fixer-return.md) | require fixer functions to return a fix | ✅ | | |
| [meta-property-ordering](docs/rules/meta-property-ordering.md) | enforce the order of meta properties | | 🔧 | |
| [no-deprecated-context-methods](docs/rules/no-deprecated-context-methods.md) | disallow usage of deprecated methods on rule context objects | ✅ | 🔧 | |
| [no-deprecated-report-api](docs/rules/no-deprecated-report-api.md) | disallow the version of `context.report()` with multiple arguments | ✅ | 🔧 | |
| [no-identical-tests](docs/rules/no-identical-tests.md) | disallow identical tests | ✅ | 🔧 | |
| [no-missing-message-ids](docs/rules/no-missing-message-ids.md) | disallow `messageId`s that are missing from `meta.messages` | ✅ | | |
| [no-missing-placeholders](docs/rules/no-missing-placeholders.md) | disallow missing placeholders in rule report messages | ✅ | | |
| [no-only-tests](docs/rules/no-only-tests.md) | disallow the test case property `only` | ✅ | | 💡 |
| [no-unused-message-ids](docs/rules/no-unused-message-ids.md) | disallow unused `messageId`s in `meta.messages` | ✅ | | |
| [no-unused-placeholders](docs/rules/no-unused-placeholders.md) | disallow unused placeholders in rule report messages | ✅ | | |
| [no-useless-token-range](docs/rules/no-useless-token-range.md) | disallow unnecessary calls to `sourceCode.getFirstToken()` and `sourceCode.getLastToken()` | ✅ | 🔧 | |
| [prefer-message-ids](docs/rules/prefer-message-ids.md) | require using `messageId` instead of `message` to report rule violations | ✅ | | |
| [prefer-object-rule](docs/rules/prefer-object-rule.md) | disallow function-style rules | ✅ | 🔧 | |
| [prefer-output-null](docs/rules/prefer-output-null.md) | disallow invalid RuleTester test cases where the `output` matches the `code` | ✅ | 🔧 | |
| [prefer-placeholders](docs/rules/prefer-placeholders.md) | require using placeholders for dynamic report messages | | | |
| [prefer-replace-text](docs/rules/prefer-replace-text.md) | require using `replaceText()` instead of `replaceTextRange()` | | | |
| [report-message-format](docs/rules/report-message-format.md) | enforce a consistent format for rule report messages | | | |
| [require-meta-docs-description](docs/rules/require-meta-docs-description.md) | require rules to implement a `meta.docs.description` property with the correct format | | | |
| [require-meta-docs-url](docs/rules/require-meta-docs-url.md) | require rules to implement a `meta.docs.url` property | | 🔧 | |
| [require-meta-fixable](docs/rules/require-meta-fixable.md) | require rules to implement a `meta.fixable` property | ✅ | | |
| [require-meta-has-suggestions](docs/rules/require-meta-has-suggestions.md) | require suggestable rules to implement a `meta.hasSuggestions` property | ✅ | 🔧 | |
| [require-meta-schema](docs/rules/require-meta-schema.md) | require rules to implement a `meta.schema` property | ✅ | | 💡 |
| [require-meta-type](docs/rules/require-meta-type.md) | require rules to implement a `meta.type` property | ✅ | | |
| [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 | | 🔧 | |
| [test-case-shorthand-strings](docs/rules/test-case-shorthand-strings.md) | enforce consistent usage of shorthand strings for test cases with no options | | 🔧 | |

<!-- end rules list -->

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

| | Name | Description |
|:--|:-----|:------------|
| ✔️ | `recommended` | enables all recommended rules in this plugin |
| | `recommended` | enables all recommended rules in this plugin |
| | `rules-recommended` | enables all recommended rules that are aimed at linting ESLint rule files |
| | `tests-recommended` | enables all recommended rules that are aimed at linting ESLint test files |
| | `all` | enables all rules in this plugin |
Expand Down
61 changes: 0 additions & 61 deletions build/generate-readme-table.js

This file was deleted.

6 changes: 4 additions & 2 deletions docs/rules/consistent-output.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Enforce consistent use of `output` assertions in rule tests (consistent-output)
# Enforce consistent use of `output` assertions in rule tests (`eslint-plugin/consistent-output`)

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

<!-- end rule header -->

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`.

Expand Down
6 changes: 4 additions & 2 deletions docs/rules/fixer-return.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Require fixer functions to return a fix (fixer-return)
# Require fixer functions to return a fix (`eslint-plugin/fixer-return`)

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

<!-- end rule header -->

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.

Expand Down
6 changes: 4 additions & 2 deletions docs/rules/meta-property-ordering.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Enforce the order of meta properties (meta-property-ordering)
# Enforce the order of meta properties (`eslint-plugin/meta-property-ordering`)

⚒️ 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.
🔧 This rule is automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix).

<!-- end rule header -->

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

Expand Down
8 changes: 5 additions & 3 deletions docs/rules/no-deprecated-context-methods.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
# Disallow usage of deprecated methods on rule context objects (no-deprecated-context-methods)
# Disallow usage of deprecated methods on rule context objects (`eslint-plugin/no-deprecated-context-methods`)

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

⚒️ 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.
🔧 This rule is automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix).

<!-- end rule header -->

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

Expand Down
8 changes: 5 additions & 3 deletions docs/rules/no-deprecated-report-api.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
# Disallow the version of `context.report()` with multiple arguments (no-deprecated-report-api)
# Disallow the version of `context.report()` with multiple arguments (`eslint-plugin/no-deprecated-report-api`)

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

⚒️ 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.
🔧 This rule is automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix).

<!-- end rule header -->

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

Expand Down
8 changes: 5 additions & 3 deletions docs/rules/no-identical-tests.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
# Disallow identical tests (no-identical-tests)
# Disallow identical tests (`eslint-plugin/no-identical-tests`)

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

⚒️ 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.
🔧 This rule is automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix).

<!-- end rule header -->

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

Expand Down
6 changes: 4 additions & 2 deletions docs/rules/no-missing-message-ids.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Disallow `messageId`s that are missing from `meta.messages` (no-missing-message-ids)
# Disallow `messageId`s that are missing from `meta.messages` (`eslint-plugin/no-missing-message-ids`)

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

<!-- end rule header -->

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`.

Expand Down
6 changes: 4 additions & 2 deletions docs/rules/no-missing-placeholders.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Disallow missing placeholders in rule report messages (no-missing-placeholders)
# Disallow missing placeholders in rule report messages (`eslint-plugin/no-missing-placeholders`)

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

<!-- end rule header -->

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

Expand Down
Loading