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

docs: auto-generate some rule option lists with eslint-doc-generator #387

Merged
merged 3 commits into from
Dec 10, 2023
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
8 changes: 6 additions & 2 deletions docs/rules/require-meta-docs-description.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,13 @@ module.exports = {

## Options

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

* `String` — `pattern` — A regular expression that the description must match. Use `'.+'` to allow anything. Defaults to `^(enforce|require|disallow)`.
| Name | Description | Type | Default |
| :-------- | :---------------------------------------------------------------------------------- | :----- | :------------------------------ |
| `pattern` | A regular expression that the description must match. Use `'.+'` to allow anything. | String | `^(enforce\|require\|disallow)` |

<!-- end auto-generated rule options list -->

## Further Reading

Expand Down
10 changes: 7 additions & 3 deletions docs/rules/require-meta-docs-url.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,13 @@ module.exports = {

## Options

This rule has an option.
<!-- begin auto-generated rule options list -->

| Name | Description | Type |
| :-------- | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :----- |
| `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 |

<!-- end auto-generated rule options list -->

```json
{
Expand All @@ -87,8 +93,6 @@ This rule has an option.
}
```

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

If you set the `pattern` option, this rule adds `meta.docs.url` property automatically when you execute `eslint --fix` command.

## Version specific URL
Expand Down
8 changes: 6 additions & 2 deletions docs/rules/require-meta-fixable.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,13 @@ module.exports = {

## Options

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

* `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.
| Name | Description | Type | Default |
| :------------------------------- | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :------ | :------ |
| `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 | `false` |

<!-- end auto-generated rule options list -->

## Further Reading

Expand Down
8 changes: 6 additions & 2 deletions docs/rules/require-meta-schema.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,13 @@ module.exports = {

## Options

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

* `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`.
| Name | Description | Type | Default |
| :------------------------------------ | :----------------------------------------------------------------------------------------------------------------------------- | :------ | :------ |
| `requireSchemaPropertyWhenOptionless` | Whether the rule should require the `meta.schema` property to be specified (with `schema: []`) for rules that have no options. | Boolean | `true` |

<!-- end auto-generated rule options list -->

## When Not To Use It

Expand Down
1 change: 1 addition & 0 deletions lib/rules/consistent-output.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ module.exports = {
{
type: 'string',
enum: ['always', 'consistent'],
default: 'consistent',
},
],
messages: {
Expand Down
3 changes: 3 additions & 0 deletions lib/rules/require-meta-docs-description.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ module.exports = {
properties: {
pattern: {
type: 'string',
description:
"A regular expression that the description must match. Use `'.+'` to allow anything.",
default: '^(enforce|require|disallow)',
},
},
additionalProperties: false,
Expand Down
6 changes: 5 additions & 1 deletion lib/rules/require-meta-docs-url.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,11 @@ module.exports = {
{
type: 'object',
properties: {
pattern: { type: 'string' },
pattern: {
type: 'string',
description:
"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.",
},
},
additionalProperties: false,
},
Expand Down
2 changes: 2 additions & 0 deletions lib/rules/require-meta-fixable.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ module.exports = {
catchNoFixerButFixableProperty: {
type: 'boolean',
default: false,
description:
"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.",
},
},
additionalProperties: false,
Expand Down
2 changes: 2 additions & 0 deletions lib/rules/require-meta-schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ module.exports = {
requireSchemaPropertyWhenOptionless: {
type: 'boolean',
default: true,
description:
'Whether the rule should require the `meta.schema` property to be specified (with `schema: []`) for rules that have no options.',
},
},
additionalProperties: false,
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
"eslint": "^8.23.0",
"eslint-config-not-an-aardvark": "^2.1.0",
"eslint-config-prettier": "^8.5.0",
"eslint-doc-generator": "^1.4.3",
"eslint-doc-generator": "^1.6.1",
"eslint-plugin-eslint-comments": "^3.2.0",
"eslint-plugin-eslint-plugin": "file:./",
"eslint-plugin-markdown": "^3.0.0",
Expand Down