Skip to content

Commit ccd0ab2

Browse files
committed
docs: auto-generate some rule option lists with eslint-doc-generator
1 parent f5f377f commit ccd0ab2

10 files changed

+39
-11
lines changed

docs/rules/require-meta-docs-description.md

+6-2
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,13 @@ module.exports = {
4949

5050
## Options
5151

52-
This rule takes an optional object containing:
52+
<!-- begin auto-generated rule options list -->
5353

54-
* `String``pattern` — A regular expression that the description must match. Use `'.+'` to allow anything. Defaults to `^(enforce|require|disallow)`.
54+
| Name | Description | Type | Default |
55+
| :-------- | :---------------------------------------------------------------------------------- | :----- | :---------------------------- |
56+
| `pattern` | A regular expression that the description must match. Use `'.+'` to allow anything. | String | `^(enforce|require|disallow)` |
57+
58+
<!-- end auto-generated rule options list -->
5559

5660
## Further Reading
5761

docs/rules/require-meta-docs-url.md

+7-3
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,13 @@ module.exports = {
7777

7878
## Options
7979

80-
This rule has an option.
80+
<!-- begin auto-generated rule options list -->
81+
82+
| Name | Description | Type |
83+
| :-------- | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :----- |
84+
| `pattern` | A pattern to enforce rule's document URL. It replaces `{{name}}` placeholder by each rule name. The rule name is the basename of each rule file. Omitting this allows any URL. | String |
85+
86+
<!-- end auto-generated rule options list -->
8187

8288
```json
8389
{
@@ -87,8 +93,6 @@ This rule has an option.
8793
}
8894
```
8995

90-
- `pattern` (`string`) ... A pattern to enforce rule's document URL. It replaces `{{name}}` placeholder by each rule name. The rule name is the basename of each rule file. Default is `undefined` which allows any URL.
91-
9296
If you set the `pattern` option, this rule adds `meta.docs.url` property automatically when you execute `eslint --fix` command.
9397

9498
## Version specific URL

docs/rules/require-meta-fixable.md

+6-2
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,13 @@ module.exports = {
9292

9393
## Options
9494

95-
This rule takes an optional object containing:
95+
<!-- begin auto-generated rule options list -->
9696

97-
* `boolean``catchNoFixerButFixableProperty` — default `false` - Whether the rule should attempt to detect rules that do not have a fixer but enable the `meta.fixable` property. This option is off by default because it increases the chance of false positives since fixers can't always be detected when helper functions are used.
97+
| Name | Description | Type |
98+
| :------------------------------- | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :------ |
99+
| `catchNoFixerButFixableProperty` | Whether the rule should attempt to detect rules that do not have a fixer but enable the `meta.fixable` property. This option is off by default because it increases the chance of false positives since fixers can't always be detected when helper functions are used. | Boolean |
100+
101+
<!-- end auto-generated rule options list -->
98102

99103
## Further Reading
100104

docs/rules/require-meta-schema.md

+6-2
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,13 @@ module.exports = {
7575

7676
## Options
7777

78-
This rule takes an optional object containing:
78+
<!-- begin auto-generated rule options list -->
7979

80-
* `boolean``requireSchemaPropertyWhenOptionless` — Whether the rule should require the `meta.schema` property to be specified (with `schema: []`) for rules that have no options. Defaults to `true`.
80+
| Name | Description | Type | Default |
81+
| :------------------------------------ | :----------------------------------------------------------------------------------------------------------------------------- | :------ | :------ |
82+
| `requireSchemaPropertyWhenOptionless` | Whether the rule should require the `meta.schema` property to be specified (with `schema: []`) for rules that have no options. | Boolean | `true` |
83+
84+
<!-- end auto-generated rule options list -->
8185

8286
## When Not To Use It
8387

lib/rules/consistent-output.js

+1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ module.exports = {
2727
{
2828
type: 'string',
2929
enum: ['always', 'consistent'],
30+
default: 'consistent',
3031
},
3132
],
3233
messages: {

lib/rules/require-meta-docs-description.js

+3
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ module.exports = {
2727
properties: {
2828
pattern: {
2929
type: 'string',
30+
description:
31+
"A regular expression that the description must match. Use `'.+'` to allow anything.",
32+
default: '^(enforce|require|disallow)',
3033
},
3134
},
3235
additionalProperties: false,

lib/rules/require-meta-docs-url.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,11 @@ module.exports = {
3131
{
3232
type: 'object',
3333
properties: {
34-
pattern: { type: 'string' },
34+
pattern: {
35+
type: 'string',
36+
description:
37+
"A pattern to enforce rule's document URL. It replaces `{{name}}` placeholder by each rule name. The rule name is the basename of each rule file. Omitting this allows any URL.",
38+
},
3539
},
3640
additionalProperties: false,
3741
},

lib/rules/require-meta-fixable.js

+2
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ module.exports = {
2929
catchNoFixerButFixableProperty: {
3030
type: 'boolean',
3131
default: false,
32+
description:
33+
"Whether the rule should attempt to detect rules that do not have a fixer but enable the `meta.fixable` property. This option is off by default because it increases the chance of false positives since fixers can't always be detected when helper functions are used.",
3234
},
3335
},
3436
additionalProperties: false,

lib/rules/require-meta-schema.js

+2
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ module.exports = {
2525
requireSchemaPropertyWhenOptionless: {
2626
type: 'boolean',
2727
default: true,
28+
description:
29+
'Whether the rule should require the `meta.schema` property to be specified (with `schema: []`) for rules that have no options.',
2830
},
2931
},
3032
additionalProperties: false,

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
"eslint": "^8.23.0",
6262
"eslint-config-not-an-aardvark": "^2.1.0",
6363
"eslint-config-prettier": "^8.5.0",
64-
"eslint-doc-generator": "^1.4.3",
64+
"eslint-doc-generator": "^1.5.0",
6565
"eslint-plugin-eslint-comments": "^3.2.0",
6666
"eslint-plugin-eslint-plugin": "file:./",
6767
"eslint-plugin-markdown": "^3.0.0",

0 commit comments

Comments
 (0)