Skip to content

Commit c123b6c

Browse files
committed
docs: automate docs with eslint-doc-generator
1 parent c3d14cb commit c123b6c

File tree

94 files changed

+343
-141
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

+343
-141
lines changed

.eslintrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@
7171
"eslint-plugin/no-deprecated-report-api": "off",
7272
"eslint-plugin/prefer-replace-text": "error",
7373
"eslint-plugin/report-message-format": "error",
74+
"eslint-plugin/require-meta-docs-description": ["error", { "pattern": "^(Enforce|Ensure|Prefer|Forbid).+\\.$" }],
7475
"eslint-plugin/require-meta-schema": "error",
7576
"eslint-plugin/require-meta-type": "error",
7677

CONTRIBUTING.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,12 @@ Thanks for your interest in helping out! Here are a **few** _weird_ tricks to ~~
55
## TL;DR: Checklist
66

77
When opening an [issue](#issues):
8+
89
- [ ] search open/closed issues
910
- [ ] discuss bug/enhancement in new or old issue
1011

1112
[PR](#prs) time:
13+
1214
- [ ] write tests
1315
- [ ] implement feature/fix bug
1416
- [ ] update docs
@@ -18,13 +20,13 @@ Remember, you don't need to do it all yourself; any of these are helpful! 😎
1820

1921
## Issues
2022

21-
### Search open + closed issues for similar cases.
23+
### Search open + closed issues for similar cases
2224

2325
You may find an open issue that closely matches what you are thinking. You may also find a closed issue with discussion that either solves your problem or explains why we are unlikely to solve it in the near future.
2426

2527
If you find a matching issue that is open, and marked `accepted` and/or `help wanted`, you might want to [open a PR](#prs).
2628

27-
### Open an issue.
29+
### Open an issue
2830

2931
Let's discuss your issue. Could be as simple as unclear documentation or a wonky config file.
3032
If you're suggesting a feature, it might exist and need better documentation, or it might be in process. Even given those, some discussion might be warranted to ensure the enhancement is clear.
@@ -48,21 +50,19 @@ Here are some things to keep in mind when working on a PR:
4850
If a PR is open, but unfortunately the author is, for any reason, not available to apply code review fixes or rebase the source branch, then please **do not open a new PR**.
4951
Instead, paste a link to your own branch in the PR, and the maintainers can pull in your changes and update the existing PR in-place.
5052

51-
#### Tests
53+
### Tests
5254

5355
A PR that is just failing test cases for an existing issue is very helpful, as this can take as much time (if not more) as it takes to implement a new feature or fix a bug.
5456

5557
If you only have enough time to write tests, fantastic! Submit away. This is a great jumping-off point for a core contributor or even another PR to continue what you've started.
5658

57-
#### Docs
58-
59-
For enhancements to rules, please update the docs in `docs/rules` matching the rule filename from `src/rules`.
59+
### Docs
6060

61-
Also, take a quick look at the rule summary in [README.md] in case it could use tweaking, or add a line if you've implemented a new rule.
61+
For enhancements to rules, please update the docs in `docs/rules` matching the rule filename from `src/rules` or the rule description in `meta.docs.description`. Running `npm run update:eslint-docs` will update the [README.md] and rule doc header.
6262

6363
Bugfixes may not warrant docs changes, though it's worth skimming the existing docs to see if there are any relevant caveats that need to be removed.
6464

65-
#### Changelog
65+
### Changelog
6666

6767
Please add a quick blurb to the [**Unreleased**](./CHANGELOG.md#unreleased) section of the change log. Give yourself some credit, and please link back to the PR for future reference. This is especially helpful for resolver changes, as the resolvers are less frequently modified and published.
6868

@@ -72,4 +72,4 @@ Note also that the change log can't magically link back to Github entities (i.e.
7272

7373
Please familiarize yourself with the [Code of Conduct](https://github.com/import-js/.github/blob/main/CODE_OF_CONDUCT.md).
7474

75-
[README.md]: ./README.md
75+
[README.md]: ./README.md

README.md

Lines changed: 80 additions & 107 deletions
Large diffs are not rendered by default.

docs/rules/consistent-type-specifier-style.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# import/consistent-type-specifier-style
22

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 auto-generated rule header -->
6+
37
In both Flow and TypeScript you can mark an import as a type-only import by adding a "kind" marker to the import. Both languages support two positions for marker.
48

59
**At the top-level** which marks all names in the import as type-only and applies to named, default, and namespace (for TypeScript) specifiers:

docs/rules/default.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# import/default
22

3+
💼 This rule is enabled in the following configs: ❗ `errors`, ☑️ `recommended`.
4+
5+
<!-- end auto-generated rule header -->
6+
37
If a default import is requested, this rule will report if there is no default
48
export in the imported module.
59

docs/rules/dynamic-import-chunkname.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# import/dynamic-import-chunkname
22

3+
<!-- end auto-generated rule header -->
4+
35
This rule reports any dynamic imports without a webpackChunkName specified in a leading block comment in the proper format.
46

57
This rule enforces naming of webpack chunks in dynamic imports. When you don't explicitly name chunks, webpack will autogenerate chunk names that are not consistent across builds, which prevents long-term browser caching.

docs/rules/export.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# import/export
22

3+
💼 This rule is enabled in the following configs: ❗ `errors`, ☑️ `recommended`.
4+
5+
<!-- end auto-generated rule header -->
6+
37
Reports funny business with exports, like repeated exports of names or defaults.
48

59
## Rule Details

docs/rules/exports-last.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# import/exports-last
22

3+
<!-- end auto-generated rule header -->
4+
35
This rule enforces that all exports are declared at the bottom of the file. This rule will report any export declarations that comes before any non-export statements.
46

57

docs/rules/extensions.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
# import/extensions - Ensure consistent use of file extension within the import path
1+
# import/extensions
2+
3+
<!-- end auto-generated rule header -->
24

35
Some file resolve algorithms allow you to omit the file extension within the import source path. For example the `node` resolver can resolve `./foo/bar` to the absolute path `/User/someone/foo/bar.js` because the `.js` extension is resolved automatically by default. Depending on the resolver you can configure more extensions to get resolved automatically.
46

@@ -37,6 +39,7 @@ By providing both a string and an object, the string will set the default settin
3739
For example, `["error", "never", { "svg": "always" }]` would require that all extensions are omitted, except for "svg".
3840

3941
`ignorePackages` can be set as a separate boolean option like this:
42+
4043
```
4144
"import/extensions": [
4245
<severity>,
@@ -49,10 +52,10 @@ For example, `["error", "never", { "svg": "always" }]` would require that all ex
4952
}
5053
]
5154
```
55+
5256
In that case, if you still want to specify extensions, you can do so inside the **pattern** property.
5357
Default value of `ignorePackages` is `false`.
5458

55-
5659
### Exception
5760

5861
When disallowing the use of certain extensions this rule makes an exception and allows the use of extension when the file would not be resolvable without extension.

docs/rules/first.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# import/first
22

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 auto-generated rule header -->
6+
37
This rule reports any imports that come after non-import
48
statements.
59

0 commit comments

Comments
 (0)