Skip to content

Commit bdfd61a

Browse files
authored
docs: cleanup docs, add markdownlint, tweak eslint-doc-generator options (#64)
1 parent 54c5e52 commit bdfd61a

36 files changed

+150
-138
lines changed

.markdownlint.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"line-length": false,
3+
"no-inline-html": {
4+
"allowed_elements": ["details"]
5+
},
6+
"ul-style": {
7+
"style": "dash"
8+
}
9+
}

.markdownlintignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
CHANGELOG.md
2+
LICENSE
3+
node_modules

README.md

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -57,43 +57,41 @@ npm install --save-dev eslint eslint-plugin-n
5757

5858
<!-- begin auto-generated rules list -->
5959

60-
💼 Configurations enabled in.\
61-
✅ Set in the `recommended` configuration.\
62-
☑️ Set in the `recommended-module` configuration.\
63-
✔️ Set in the `recommended-script` configuration.\
60+
💼 [Configurations](https://github.com/eslint-community/eslint-plugin-n#-configs) enabled in.\
61+
✅ Set in the `recommended` [configuration](https://github.com/eslint-community/eslint-plugin-n#-configs).\
6462
🔧 Automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/user-guide/command-line-interface#--fix).\
6563
❌ Deprecated.
6664

6765
### Best Practices
6866

69-
| Name | Description | 💼 | 🔧 ||
70-
| :--------------------------------------------------- | :----------------------- | :------ | :- | :- |
71-
| [no-deprecated-api](docs/rules/no-deprecated-api.md) | disallow deprecated APIs |☑️ ✔️ | | |
67+
| Name | Description | 💼 | 🔧 ||
68+
| :--------------------------------------------------- | :----------------------- | :- | :- | :- |
69+
| [no-deprecated-api](docs/rules/no-deprecated-api.md) | disallow deprecated APIs || | |
7270

7371
### Possible Errors
7472

75-
| Name                                  | Description | 💼 | 🔧 ||
76-
| :------------------------------------------------------------------------------------------- | :-------------------------------------------------------------------------- | :------ | :- | :- |
77-
| [handle-callback-err](docs/rules/handle-callback-err.md) | require error handling in callbacks | | | |
78-
| [no-callback-literal](docs/rules/no-callback-literal.md) | enforce Node.js-style error-first callback pattern is followed | | | |
79-
| [no-exports-assign](docs/rules/no-exports-assign.md) | disallow the assignment to `exports` |☑️ ✔️ | | |
80-
| [no-extraneous-import](docs/rules/no-extraneous-import.md) | disallow `import` declarations which import extraneous modules |☑️ ✔️ | | |
81-
| [no-extraneous-require](docs/rules/no-extraneous-require.md) | disallow `require()` expressions which import extraneous modules |☑️ ✔️ | | |
82-
| [no-hide-core-modules](docs/rules/no-hide-core-modules.md) | disallow third-party modules which are hiding core modules | | ||
83-
| [no-missing-import](docs/rules/no-missing-import.md) | disallow `import` declarations which import non-existence modules |☑️ ✔️ | | |
84-
| [no-missing-require](docs/rules/no-missing-require.md) | disallow `require()` expressions which import non-existence modules |☑️ ✔️ | | |
85-
| [no-new-require](docs/rules/no-new-require.md) | disallow `new` operators with calls to `require` | | | |
86-
| [no-path-concat](docs/rules/no-path-concat.md) | disallow string concatenation with `__dirname` and `__filename` | | | |
87-
| [no-process-exit](docs/rules/no-process-exit.md) | disallow the use of `process.exit()` |☑️ ✔️ | | |
88-
| [no-unpublished-bin](docs/rules/no-unpublished-bin.md) | disallow `bin` files that npm ignores |☑️ ✔️ | | |
89-
| [no-unpublished-import](docs/rules/no-unpublished-import.md) | disallow `import` declarations which import private modules |☑️ ✔️ | | |
90-
| [no-unpublished-require](docs/rules/no-unpublished-require.md) | disallow `require()` expressions which import private modules |☑️ ✔️ | | |
91-
| [no-unsupported-features](docs/rules/no-unsupported-features.md) | disallow unsupported ECMAScript features on the specified version | | ||
92-
| [no-unsupported-features/es-builtins](docs/rules/no-unsupported-features/es-builtins.md) | disallow unsupported ECMAScript built-ins on the specified version |☑️ ✔️ | | |
93-
| [no-unsupported-features/es-syntax](docs/rules/no-unsupported-features/es-syntax.md) | disallow unsupported ECMAScript syntax on the specified version |☑️ ✔️ | | |
94-
| [no-unsupported-features/node-builtins](docs/rules/no-unsupported-features/node-builtins.md) | disallow unsupported Node.js built-in APIs on the specified version |☑️ ✔️ | | |
95-
| [process-exit-as-throw](docs/rules/process-exit-as-throw.md) | require that `process.exit()` expressions use the same code path as `throw` |☑️ ✔️ | | |
96-
| [shebang](docs/rules/shebang.md) | require correct usage of shebang |☑️ ✔️ | 🔧 | |
73+
| Name                                  | Description | 💼 | 🔧 ||
74+
| :------------------------------------------------------------------------------------------- | :-------------------------------------------------------------------------- | :- | :- | :- |
75+
| [handle-callback-err](docs/rules/handle-callback-err.md) | require error handling in callbacks | | | |
76+
| [no-callback-literal](docs/rules/no-callback-literal.md) | enforce Node.js-style error-first callback pattern is followed | | | |
77+
| [no-exports-assign](docs/rules/no-exports-assign.md) | disallow the assignment to `exports` || | |
78+
| [no-extraneous-import](docs/rules/no-extraneous-import.md) | disallow `import` declarations which import extraneous modules || | |
79+
| [no-extraneous-require](docs/rules/no-extraneous-require.md) | disallow `require()` expressions which import extraneous modules || | |
80+
| [no-hide-core-modules](docs/rules/no-hide-core-modules.md) | disallow third-party modules which are hiding core modules | | ||
81+
| [no-missing-import](docs/rules/no-missing-import.md) | disallow `import` declarations which import non-existence modules || | |
82+
| [no-missing-require](docs/rules/no-missing-require.md) | disallow `require()` expressions which import non-existence modules || | |
83+
| [no-new-require](docs/rules/no-new-require.md) | disallow `new` operators with calls to `require` | | | |
84+
| [no-path-concat](docs/rules/no-path-concat.md) | disallow string concatenation with `__dirname` and `__filename` | | | |
85+
| [no-process-exit](docs/rules/no-process-exit.md) | disallow the use of `process.exit()` || | |
86+
| [no-unpublished-bin](docs/rules/no-unpublished-bin.md) | disallow `bin` files that npm ignores || | |
87+
| [no-unpublished-import](docs/rules/no-unpublished-import.md) | disallow `import` declarations which import private modules || | |
88+
| [no-unpublished-require](docs/rules/no-unpublished-require.md) | disallow `require()` expressions which import private modules || | |
89+
| [no-unsupported-features](docs/rules/no-unsupported-features.md) | disallow unsupported ECMAScript features on the specified version | | ||
90+
| [no-unsupported-features/es-builtins](docs/rules/no-unsupported-features/es-builtins.md) | disallow unsupported ECMAScript built-ins on the specified version || | |
91+
| [no-unsupported-features/es-syntax](docs/rules/no-unsupported-features/es-syntax.md) | disallow unsupported ECMAScript syntax on the specified version || | |
92+
| [no-unsupported-features/node-builtins](docs/rules/no-unsupported-features/node-builtins.md) | disallow unsupported Node.js built-in APIs on the specified version || | |
93+
| [process-exit-as-throw](docs/rules/process-exit-as-throw.md) | require that `process.exit()` expressions use the same code path as `throw` || | |
94+
| [shebang](docs/rules/shebang.md) | require correct usage of shebang || 🔧 | |
9795

9896
### Stylistic Issues
9997

@@ -124,11 +122,13 @@ npm install --save-dev eslint eslint-plugin-n
124122

125123
This plugin provides three configs:
126124

127-
- `plugin:n/recommended` considers both CommonJS and ES Modules. If [`"type":"module"` field](https://medium.com/@nodejs/announcing-a-new-experimental-modules-1be8d2d6c2ff#b023) existed in package.json then it considers files as ES Modules. Otherwise it considers files as CommonJS. In addition, it considers `*.mjs` files as ES Modules and `*.cjs` files as CommonJS.
128-
- `plugin:n/recommended-module` considers all files as ES Modules.
129-
- `plugin:n/recommended-script` considers all files as CommonJS.
125+
| Name | Description |
126+
| :-- | :-- |
127+
| `plugin:n/recommended` | Considers both CommonJS and ES Modules. If [`"type":"module"` field](https://medium.com/@nodejs/announcing-a-new-experimental-modules-1be8d2d6c2ff#b023) existed in package.json then it considers files as ES Modules. Otherwise it considers files as CommonJS. In addition, it considers `*.mjs` files as ES Modules and `*.cjs` files as CommonJS. |
128+
| `plugin:n/recommended-module` | Considers all files as ES Modules. |
129+
| `plugin:n/recommended-script` | Considers all files as CommonJS. |
130130

131-
Those preset config:
131+
These preset configs:
132132

133133
- enable [no-process-exit](http://eslint.org/docs/rules/no-process-exit) rule because [the official document](https://nodejs.org/api/process.html#process_process_exit_code) does not recommend a use of `process.exit()`.
134134
- enable plugin rules which are given ✅ in the above table.

docs/rules/callback-return.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,8 @@ function bar(err, send) {
102102

103103
Because it is difficult to understand the meaning of a program through static analysis, this rule has limitations:
104104

105-
* *false negatives* when this rule reports correct code, but the program calls the callback more than one time (which is incorrect behavior)
106-
* *false positives* when this rule reports incorrect code, but the program calls the callback only one time (which is correct behavior)
105+
- *false negatives* when this rule reports correct code, but the program calls the callback more than one time (which is incorrect behavior)
106+
- *false positives* when this rule reports incorrect code, but the program calls the callback only one time (which is correct behavior)
107107

108108
#### Passing the callback by reference
109109

docs/rules/exports-style.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ In this case, `exports.bar` will be lost since only the instance of `module.expo
2121

2222
This rule enforces the export style.
2323

24-
If you use `module.exports`, this rule disallows `exports`.<br>
24+
If you use `module.exports`, this rule disallows `exports`.\
2525
If you use `exports`, this rule disallows `module.exports`.
2626

2727
You can select it by an option.
@@ -48,7 +48,7 @@ This rule has a string option.
4848

4949
#### module.exports
5050

51-
Examples of :-1: **incorrect** code for the `"module.exports"` option:
51+
Examples of 👎 **incorrect** code for the `"module.exports"` option:
5252

5353
```js
5454
/*eslint n/exports-style: ["error", "module.exports"]*/
@@ -57,7 +57,7 @@ exports.foo = 1
5757
exports.bar = 2
5858
```
5959

60-
Examples of :+1: **correct** code for the `"module.exports"` option:
60+
Examples of 👍 **correct** code for the `"module.exports"` option:
6161

6262
```js
6363
/*eslint n/exports-style: ["error", "module.exports"]*/
@@ -72,7 +72,7 @@ module.exports.baz = 3
7272

7373
#### exports
7474

75-
Examples of :-1: **incorrect** code for the `"exports"` option:
75+
Examples of 👎 **incorrect** code for the `"exports"` option:
7676

7777
```js
7878
/*eslint n/exports-style: ["error", "exports"]*/
@@ -85,7 +85,7 @@ module.exports = {
8585
module.exports.baz = 3
8686
```
8787

88-
Examples of :+1: **correct** code for the `"exports"` option:
88+
Examples of 👍 **correct** code for the `"exports"` option:
8989

9090
```js
9191
/*eslint n/exports-style: ["error", "exports"]*/
@@ -96,7 +96,7 @@ exports.bar = 2
9696

9797
#### allowBatchAssign
9898

99-
Examples of :+1: **correct** code for the `"exports"` and `{"allowBatchAssign": true}` option:
99+
Examples of 👍 **correct** code for the `"exports"` and `{"allowBatchAssign": true}` option:
100100

101101
```js
102102
/*eslint n/exports-style: ["error", "exports", {"allowBatchAssign": true}]*/

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,15 @@ This rule has a string option and an object option.
4141

4242
#### always
4343

44-
Examples of :-1: **incorrect** code for the `"always"` option:
44+
Examples of 👎 **incorrect** code for the `"always"` option:
4545

4646
```js
4747
/*eslint n/file-extension-in-import: ["error", "always"]*/
4848

4949
import foo from "./path/to/a/file"
5050
```
5151

52-
Examples of :+1: **correct** code for the `"always"` option:
52+
Examples of 👍 **correct** code for the `"always"` option:
5353

5454
```js
5555
/*eslint n/file-extension-in-import: ["error", "always"]*/
@@ -60,15 +60,15 @@ import foo from "./path/to/a/file.js"
6060

6161
#### never
6262

63-
Examples of :-1: **incorrect** code for the `"never"` option:
63+
Examples of 👎 **incorrect** code for the `"never"` option:
6464

6565
```js
6666
/*eslint n/file-extension-in-import: ["error", "never"]*/
6767

6868
import foo from "./path/to/a/file.js"
6969
```
7070

71-
Examples of :+1: **correct** code for the `"never"` option:
71+
Examples of 👍 **correct** code for the `"never"` option:
7272

7373
```js
7474
/*eslint n/file-extension-in-import: ["error", "never"]*/
@@ -79,7 +79,7 @@ import foo from "./path/to/a/file"
7979

8080
#### .xxx
8181

82-
Examples of :+1: **correct** code for the `["always", { ".js": "never" }]` option:
82+
Examples of 👍 **correct** code for the `["always", { ".js": "never" }]` option:
8383

8484
```js
8585
/*eslint n/file-extension-in-import: ["error", "always", { ".js": "never" }]*/

docs/rules/handle-callback-err.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,9 @@ so you need a more flexible configuration to ensure that the rule reports all un
6868

6969
If the configured name of the error variable begins with a `^` it is considered to be a regexp pattern.
7070

71-
* If the option is `"^(err|error|anySpecificError)$"`, the rule reports unhandled errors where the parameter name can be `err`, `error` or `anySpecificError`.
72-
* If the option is `"^.+Error$"`, the rule reports unhandled errors where the parameter name ends with `Error` (for example, `connectionError` or `validationError` will match).
73-
* If the option is `"^.*(e|E)rr"`, the rule reports unhandled errors where the parameter name matches any string that contains `err` or `Err` (for example, `err`, `error`, `anyError`, `some_err` will match).
71+
- If the option is `"^(err|error|anySpecificError)$"`, the rule reports unhandled errors where the parameter name can be `err`, `error` or `anySpecificError`.
72+
- If the option is `"^.+Error$"`, the rule reports unhandled errors where the parameter name ends with `Error` (for example, `connectionError` or `validationError` will match).
73+
- If the option is `"^.*(e|E)rr"`, the rule reports unhandled errors where the parameter name matches any string that contains `err` or `Err` (for example, `err`, `error`, `anyError`, `some_err` will match).
7474

7575
## 🔎 Implementation
7676

docs/rules/no-callback-literal.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ When invoking a callback function which uses the Node.js error-first callback pa
88

99
When a function is named `cb` or `callback`, then it must be invoked with a first argument that is `undefined`, `null`, an `Error` class, or a subclass or `Error`.
1010

11-
Examples of :-1: **incorrect** code for this rule:
11+
Examples of 👎 **incorrect** code for this rule:
1212

1313
```js
1414
/*eslint n/no-callback-literal: "error" */
@@ -18,7 +18,7 @@ cb({ a: 1 });
1818
callback(0);
1919
```
2020

21-
Examples of :+1: **correct** code for this rule:
21+
Examples of 👍 **correct** code for this rule:
2222

2323
```js
2424
/*eslint n/no-callback-literal: "error" */

docs/rules/no-deprecated-api.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Disallow deprecated APIs (`n/no-deprecated-api`)
22

3-
💼 This rule is enabled in the following configs: `recommended`, ☑️ `recommended-module`, ✔️ `recommended-script`.
3+
💼 This rule is enabled in the ✅ `recommended` [config](https://github.com/eslint-community/eslint-plugin-n#-configs).
44

55
<!-- end auto-generated rule header -->
66

@@ -9,7 +9,7 @@ The community is going to remove those API from Node in future, so we should not
99

1010
## 📖 Rule Details
1111

12-
Examples of :-1: **incorrect** code for this rule:
12+
Examples of 👎 **incorrect** code for this rule:
1313

1414
```js
1515
/*eslint n/no-deprecated-api: "error" */
@@ -272,7 +272,7 @@ This option can include the following values:
272272
- `util._extend`
273273
- `vm.runInDebugContext`
274274

275-
Examples of :+1: **correct** code for the `{"ignoreModuleItems": ["new buffer.Buffer()"]}`:
275+
Examples of 👍 **correct** code for the `{"ignoreModuleItems": ["new buffer.Buffer()"]}`:
276276

277277
```js
278278
/*eslint n/no-deprecated-api: [error, {ignoreModuleItems: ["new buffer.Buffer()"]}] */
@@ -304,7 +304,7 @@ This option can include the following values:
304304
- `process.binding`
305305
- `process.env.NODE_REPL_HISTORY_FILE`
306306

307-
Examples of :+1: **correct** code for the `{"ignoreGlobalItems": ["new Buffer()"]}`:
307+
Examples of 👍 **correct** code for the `{"ignoreGlobalItems": ["new Buffer()"]}`:
308308

309309
```js
310310
/*eslint n/no-deprecated-api: [error, {ignoreGlobalItems: ["new Buffer()"]}] */

docs/rules/no-exports-assign.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Disallow the assignment to `exports` (`n/no-exports-assign`)
22

3-
💼 This rule is enabled in the following configs: `recommended`, ☑️ `recommended-module`, ✔️ `recommended-script`.
3+
💼 This rule is enabled in the ✅ `recommended` [config](https://github.com/eslint-community/eslint-plugin-n#-configs).
44

55
<!-- end auto-generated rule header -->
66

0 commit comments

Comments
 (0)