Skip to content

Commit 237b2a1

Browse files
authored
docs: automate docs with eslint-doc-generator (#61)
1 parent 162430b commit 237b2a1

Some content is hidden

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

50 files changed

+426
-466
lines changed

.eslintrc.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ module.exports = {
1717
env: {
1818
mocha: true,
1919
},
20+
rules: {
21+
"eslint-plugin/require-meta-docs-description": "error",
22+
},
2023
overrides: [
2124
{
2225
// these messageIds were used outside

README.md

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

docs/rules/callback-return.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
# n/callback-return
2-
> require `return` statements after callbacks
1+
# Require `return` statements after callbacks (`n/callback-return`)
2+
3+
<!-- end auto-generated rule header -->
34

45
The callback pattern is at the heart of most I/O and event-driven programming
56
in JavaScript.

docs/rules/exports-style.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
# n/exports-style
2-
> enforce either `module.exports` or `exports`
3-
> - ✒️ 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.
1+
# Enforce either `module.exports` or `exports` (`n/exports-style`)
2+
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 -->
46

57
`module.exports` and `exports` are the same instance by default.
68
But those come to be different if one of them is modified.

docs/rules/file-extension-in-import.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
# n/file-extension-in-import
2-
> enforce the style of file extensions in `import` declarations
3-
> - ✒️ 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.
1+
# Enforce the style of file extensions in `import` declarations (`n/file-extension-in-import`)
2+
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 -->
46

57
We can omit file extensions in `import`/`export` declarations.
68

docs/rules/global-require.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
# n/global-require
2-
> require `require()` calls to be placed at top-level module scope
1+
# Require `require()` calls to be placed at top-level module scope (`n/global-require`)
2+
3+
<!-- end auto-generated rule header -->
34

45
In Node.js, module dependencies are included using the `require()` function, such as:
56

docs/rules/handle-callback-err.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
# n/handle-callback-err
2-
> require error handling in callbacks
1+
# Require error handling in callbacks (`n/handle-callback-err`)
2+
3+
<!-- end auto-generated rule header -->
34

45
In Node.js, a common pattern for dealing with asynchronous behavior is called the callback pattern.
56
This pattern expects an `Error` object or `null` as the first argument of the callback.

docs/rules/no-callback-literal.md

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
# n/no-callback-literal
2-
> ensure Node.js-style error-first callback pattern is followed
1+
# Enforce Node.js-style error-first callback pattern is followed (`n/no-callback-literal`)
2+
3+
<!-- end auto-generated rule header -->
34

45
When invoking a callback function which uses the Node.js error-first callback pattern, all of your errors should either use the `Error` class or a subclass of it. It is also acceptable to use `undefined` or `null` if there is no error.
56

@@ -28,16 +29,6 @@ callback(new Error('some error'));
2829
callback(someVariable);
2930
```
3031

31-
### Options
32-
33-
```json
34-
{
35-
"rules": {
36-
"n/no-callback-literal": "error"
37-
}
38-
}
39-
```
40-
4132
## 🔎 Implementation
4233

4334
- [Rule source](../../lib/rules/no-callback-literal.js)

docs/rules/no-deprecated-api.md

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

docs/rules/no-exports-assign.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
# n/no-exports-assign
2-
> disallow the assignment to `exports`
3-
> - ⭐️ This rule is included in `plugin:n/recommended` preset.
1+
# Disallow the assignment to `exports` (`n/no-exports-assign`)
2+
3+
💼 This rule is enabled in the following configs: ✅ `recommended`, ☑️ `recommended-module`, ✔️ `recommended-script`.
4+
5+
<!-- end auto-generated rule header -->
46

57
To assign to `exports` variable would not work as expected.
68

0 commit comments

Comments
 (0)