Skip to content

Commit d3dbbfd

Browse files
bmishota-meshi
andauthored
Automate docs with eslint-doc-generator (#493)
* docs: automate docs with eslint-doc-generator * docs: update to eslint-doc-generator 0.28 * docs: update to eslint-doc-generator 1.0 * docs: update to eslint-doc-generator 1.2 with new ruleListSplit function * use config-format option * urlRuleDoc function * tweak config * fix relative rule paths * remove deprecated column Co-authored-by: Yosuke Ota <[email protected]>
1 parent 05b6475 commit d3dbbfd

File tree

94 files changed

+1039
-611
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

94 files changed

+1039
-611
lines changed

.eslint-doc-generatorrc.js

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
/** @type {import('eslint-doc-generator').GenerateOptions} */
2+
const config = {
3+
configFormat: 'plugin-colon-prefix-name',
4+
ignoreConfig: ['all'],
5+
pathRuleList: ['README.md', 'docs/rules/index.md'],
6+
ruleDocSectionInclude: ['Rule Details', 'Version', 'Implementation'],
7+
ruleDocSectionOptions: false,
8+
ruleDocTitleFormat: 'prefix-name',
9+
ruleListColumns: [
10+
// All standard columns except `deprecated` since we split the list such that there's a dedicated "Deprecated" section.
11+
'name',
12+
'description',
13+
'configsError',
14+
'configsWarn',
15+
'configsOff',
16+
'fixable',
17+
'hasSuggestions',
18+
'requiresTypeChecking',
19+
],
20+
ruleListSplit(rules) {
21+
return [
22+
{
23+
title: 'Possible Errors',
24+
rules: rules.filter(
25+
([, rule]) => rule.meta.docs.category === 'Possible Errors' && !rule.meta.deprecated
26+
),
27+
},
28+
{
29+
title: 'Best Practices',
30+
rules: rules.filter(
31+
([, rule]) => rule.meta.docs.category === 'Best Practices' && !rule.meta.deprecated
32+
),
33+
},
34+
{
35+
title: 'Stylistic Issues',
36+
rules: rules.filter(
37+
([, rule]) => rule.meta.docs.category === 'Stylistic Issues' && !rule.meta.deprecated
38+
),
39+
},
40+
{
41+
title: 'Deprecated',
42+
rules: rules.filter(([, rule]) => rule.meta.deprecated),
43+
},
44+
];
45+
},
46+
urlRuleDoc(name, page) {
47+
if (page === 'README.md') {
48+
// Use URLs only in the README to link to the vitepress SPA. Otherwise, fallback to relative URLs.
49+
return `https://ota-meshi.github.io/eslint-plugin-regexp/rules/${name}.html`;
50+
}
51+
},
52+
};
53+
54+
module.exports = config;

README.md

Lines changed: 94 additions & 97 deletions
Large diffs are not rendered by default.

docs/rules/confusing-quantifier.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,11 @@ since: "v0.8.0"
77
---
88
# regexp/confusing-quantifier
99

10-
> disallow confusing quantifiers
10+
⚠️ This rule _warns_ in the ✅ `plugin:regexp/recommended` config.
11+
12+
<!-- end auto-generated rule header -->
1113

12-
- :gear: This rule is included in `"plugin:regexp/recommended"`.
14+
> disallow confusing quantifiers
1315
1416
## :book: Rule Details
1517

docs/rules/control-character-escape.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,13 @@ since: "v0.9.0"
77
---
88
# regexp/control-character-escape
99

10-
> enforce consistent escaping of control characters
10+
💼 This rule is enabled in the ✅ `plugin:regexp/recommended` config.
11+
12+
🔧 This rule is automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix).
1113

12-
- :gear: This rule is included in `"plugin:regexp/recommended"`.
13-
- :wrench: The `--fix` option on the [command line](https://eslint.org/docs/user-guide/command-line-interface#fixing-problems) can automatically fix some of the problems reported by this rule.
14+
<!-- end auto-generated rule header -->
15+
16+
> enforce consistent escaping of control characters
1417
1518
## :book: Rule Details
1619

docs/rules/hexadecimal-escape.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,11 @@ since: "v0.9.0"
77
---
88
# regexp/hexadecimal-escape
99

10-
> enforce consistent usage of hexadecimal escape
10+
🔧 This rule is automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix).
11+
12+
<!-- end auto-generated rule header -->
1113

12-
- :wrench: The `--fix` option on the [command line](https://eslint.org/docs/user-guide/command-line-interface#fixing-problems) can automatically fix some of the problems reported by this rule.
14+
> enforce consistent usage of hexadecimal escape
1315
1416
## :book: Rule Details
1517

docs/rules/index.md

Lines changed: 98 additions & 97 deletions
Large diffs are not rendered by default.

docs/rules/letter-case.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,11 @@ since: "v0.3.0"
77
---
88
# regexp/letter-case
99

10-
> enforce into your favorite case
10+
🔧 This rule is automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix).
11+
12+
<!-- end auto-generated rule header -->
1113

12-
- :wrench: The `--fix` option on the [command line](https://eslint.org/docs/user-guide/command-line-interface#fixing-problems) can automatically fix some of the problems reported by this rule.
14+
> enforce into your favorite case
1315
1416
## :book: Rule Details
1517

docs/rules/match-any.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,13 @@ since: "v0.1.0"
77
---
88
# regexp/match-any
99

10-
> enforce match any character style
10+
💼 This rule is enabled in the ✅ `plugin:regexp/recommended` config.
11+
12+
🔧 This rule is automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix).
1113

12-
- :gear: This rule is included in `"plugin:regexp/recommended"`.
13-
- :wrench: The `--fix` option on the [command line](https://eslint.org/docs/user-guide/command-line-interface#fixing-problems) can automatically fix some of the problems reported by this rule.
14+
<!-- end auto-generated rule header -->
15+
16+
> enforce match any character style
1417
1518
## :book: Rule Details
1619

docs/rules/negation.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,13 @@ since: "v0.4.0"
77
---
88
# regexp/negation
99

10-
> enforce use of escapes on negation
10+
💼 This rule is enabled in the ✅ `plugin:regexp/recommended` config.
11+
12+
🔧 This rule is automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix).
1113

12-
- :gear: This rule is included in `"plugin:regexp/recommended"`.
13-
- :wrench: The `--fix` option on the [command line](https://eslint.org/docs/user-guide/command-line-interface#fixing-problems) can automatically fix some of the problems reported by this rule.
14+
<!-- end auto-generated rule header -->
15+
16+
> enforce use of escapes on negation
1417
1518
## :book: Rule Details
1619

docs/rules/no-assertion-capturing-group.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,11 @@ since: "v0.1.0"
77
---
88
# regexp/no-assertion-capturing-group
99

10-
> disallow capturing group that captures empty.
10+
❌ This rule is deprecated. It was replaced by [`regexp/no-empty-capturing-group`](no-empty-capturing-group.md).
11+
12+
<!-- end auto-generated rule header -->
1113

12-
- :warning: This rule was **deprecated** and replaced by [regexp/no-empty-capturing-group](no-empty-capturing-group.md) rule.
14+
> disallow capturing group that captures empty.
1315
1416
## :book: Rule Details
1517

0 commit comments

Comments
 (0)