Skip to content

Commit 11d2d41

Browse files
committed
📝 tweak documents
1 parent a84a009 commit 11d2d41

17 files changed

+26
-45
lines changed

Diff for: docs/rules/file-extension-in-import.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# node/file-extension-in-import
22
> enforce the style of file extensions in `import` declarations
3-
4-
- ✒️ 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.
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.
54
65
We can omit file extensions in `import`/`export` declarations.
76

Diff for: docs/rules/no-deprecated-api.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# node/no-deprecated-api
22
> disallow deprecated APIs
3-
4-
- ⭐️ This rule is included in `plugin:node/recommended` preset.
3+
> - ⭐️ This rule is included in `plugin:node/recommended` preset.
54
65
Node has many deprecated API.
76
The community is going to remove those API from Node in future, so we should not use those.

Diff for: docs/rules/no-extraneous-import.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# node/no-extraneous-import
22
> disallow `import` declarations which import extraneous modules
3-
4-
- ⭐️ This rule is included in `plugin:node/recommended` preset.
3+
> - ⭐️ This rule is included in `plugin:node/recommended` preset.
54
65
If an `import` declaration's source is extraneous (it's not written in `package.json`), the program works in local, but will not work after dependencies are re-installed. It will cause troubles to your team/contributors.
76
This rule disallows `import` declarations of extraneous modules.

Diff for: docs/rules/no-extraneous-require.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# node/no-extraneous-require
22
> disallow `require()` expressions which import extraneous modules
3-
4-
- ⭐️ This rule is included in `plugin:node/recommended` preset.
3+
> - ⭐️ This rule is included in `plugin:node/recommended` preset.
54
65
If a `require()`'s target is extraneous (it's not written in `package.json`), the program works in local, but will not work after dependencies are re-installed. It will cause troubles to your team/contributors.
76
This rule disallows `require()` of extraneous modules.

Diff for: docs/rules/no-hide-core-modules.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# node/no-hide-core-modules
22
> disallow third-party modules which are hiding core modules
3-
4-
- ⛔ This rule has been deprecated.
3+
> - ⛔ This rule has been deprecated.
54
65
**:warning: This is deprecated since v4.2.0.** This rule was based on an invalid assumption. See also [#69](https://github.com/mysticatea/eslint-plugin-node/issues/69).
76

Diff for: docs/rules/no-missing-import.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# node/no-missing-import
22
> disallow `import` declarations which import non-existence modules
3-
4-
- ⭐️ This rule is included in `plugin:node/recommended` preset.
3+
> - ⭐️ This rule is included in `plugin:node/recommended` preset.
54
65
This is similar to [no-missing-require](no-missing-require.md), but this rule handles `import` and `export` declarations.
76

Diff for: docs/rules/no-missing-require.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# node/no-missing-require
22
> disallow `require()` expressions which import non-existence modules
3-
4-
- ⭐️ This rule is included in `plugin:node/recommended` preset.
3+
> - ⭐️ This rule is included in `plugin:node/recommended` preset.
54
65
Maybe we cannot find typo of import paths until run it, so this rule checks import paths.
76

Diff for: docs/rules/no-unpublished-bin.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# node/no-unpublished-bin
22
> disallow `bin` files that npm ignores
3-
4-
- ⭐️ This rule is included in `plugin:node/recommended` preset.
3+
> - ⭐️ This rule is included in `plugin:node/recommended` preset.
54
65
We can publish CLI commands by `npm`. It uses `bin` field of `package.json`.
76

Diff for: docs/rules/no-unpublished-import.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# node/no-unpublished-import
22
> disallow `import` declarations which import private modules
3-
4-
- ⭐️ This rule is included in `plugin:node/recommended` preset.
3+
> - ⭐️ This rule is included in `plugin:node/recommended` preset.
54
65
This is similar to [no-unpublished-require](no-unpublished-require.md), but this rule handles `import` declarations.
76

Diff for: docs/rules/no-unpublished-require.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# node/no-unpublished-require
22
> disallow `require()` expressions which import private modules
3-
4-
- ⭐️ This rule is included in `plugin:node/recommended` preset.
3+
> - ⭐️ This rule is included in `plugin:node/recommended` preset.
54
65
If a `require()` expression's target is not published, the program works in local, but will not work after published to npm.
76
This rule disallows `require()` expressions of unpublished files/modules.

Diff for: docs/rules/no-unsupported-features.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# node/no-unsupported-features
22
> disallow unsupported ECMAScript features on the specified version
3-
4-
- ⛔ This rule has been deprecated. Use [node/no-unsupported-features/es-syntax](./no-unsupported-features/es-syntax.md) and [node/no-unsupported-features/es-builtins](./no-unsupported-features/es-builtins.md) instead.
3+
> - ⛔ This rule has been deprecated. Use [node/no-unsupported-features/es-syntax](./no-unsupported-features/es-syntax.md) and [node/no-unsupported-features/es-builtins](./no-unsupported-features/es-builtins.md) instead.
54
65
**:warning: This is deprecated since v7.0.0.** Use [node/no-unsupported-features/es-syntax](./no-unsupported-features/es-syntax.md) and [node/no-unsupported-features/es-builtins](./no-unsupported-features/es-builtins.md) instead.
76

Diff for: docs/rules/no-unsupported-features/es-builtins.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# node/no-unsupported-features/es-builtins
22
> disallow unsupported ECMAScript built-ins on the specified version
3-
4-
- ⭐️ This rule is included in `plugin:node/recommended` preset.
3+
> - ⭐️ This rule is included in `plugin:node/recommended` preset.
54
65
ECMAScript standard is updating every two months.
76
You can check [node.green](https://node.green/) to know which Node.js version supports each ECMAScript feature.

Diff for: docs/rules/no-unsupported-features/es-syntax.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# node/no-unsupported-features/es-syntax
22
> disallow unsupported ECMAScript syntax on the specified version
3-
4-
- ⭐️ This rule is included in `plugin:node/recommended` preset.
3+
> - ⭐️ This rule is included in `plugin:node/recommended` preset.
54
65
ECMAScript standard is updating every two months.
76
You can check [node.green](https://node.green/) to know which Node.js version supports each ECMAScript feature.

Diff for: docs/rules/no-unsupported-features/node-builtins.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# node/no-unsupported-features/node-builtins
22
> disallow unsupported Node.js built-in APIs on the specified version
3-
4-
- ⭐️ This rule is included in `plugin:node/recommended` preset.
3+
> - ⭐️ This rule is included in `plugin:node/recommended` preset.
54
65
Node.js community is improving built-in APIs continuously.
76
You can check [Node.js Documentation](https://nodejs.org/api/) to know which Node.js version supports each Node.js API.

Diff for: docs/rules/process-exit-as-throw.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# node/process-exit-as-throw
22
> make `process.exit()` expressions the same code path as `throw`
3-
4-
- ⭐️ This rule is included in `plugin:node/recommended` preset.
3+
> - ⭐️ This rule is included in `plugin:node/recommended` preset.
54
65
## 📖 Rule Details
76

Diff for: docs/rules/shebang.md

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
# node/shebang
22
> suggest correct usage of shebang
3-
4-
- ⭐️ This rule is included in `plugin:node/recommended` preset.
5-
- ✒️ 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.
3+
> - ⭐️ This rule is included in `plugin:node/recommended` preset.
4+
> - ✒️ 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.
65
76
When we make a CLI tool with Node.js, we add `bin` field to `package.json`, then we add a shebang the entry file.
87
This rule suggests correct usage of shebang.

Diff for: scripts/update-docs-header-and-footer.js

+9-12
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
const fs = require("fs")
88
const path = require("path")
99
const { rules } = require("./rules")
10-
const headerPattern = /^#.+\n(?:>.+\n)?(?:\n(?:-.+\n)+)?\n+/u
10+
const headerPattern = /^#.+\n(?:>.+\n)*\n+/u
1111
const footerPattern = /\n+## 🔎 Implementation[\s\S]*$/u
1212
const ruleRoot = path.resolve(__dirname, "../lib/rules")
1313
const testRoot = path.resolve(__dirname, "../tests/lib/rules")
@@ -22,17 +22,16 @@ const listFormatter = new Intl.ListFormat("en", { type: "conjunction" })
2222
* @returns {string} The document header.
2323
*/
2424
function renderHeader(rule) {
25-
const title = `# ${rule.id}\n> ${rule.description}`
26-
const notes = []
25+
const lines = [`# ${rule.id}`, `> ${rule.description}`]
2726

2827
if (rule.recommended) {
29-
notes.push(
30-
"- ⭐️ This rule is included in `plugin:node/recommended` preset."
28+
lines.push(
29+
"> - ⭐️ This rule is included in `plugin:node/recommended` preset."
3130
)
3231
}
3332
if (rule.fixable) {
34-
notes.push(
35-
"- ✒️ 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."
33+
lines.push(
34+
"> - ✒️ 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."
3635
)
3736
}
3837
if (rule.deprecated) {
@@ -43,13 +42,11 @@ function renderHeader(rule) {
4342
replace.length === 0
4443
? ""
4544
: ` Use ${listFormatter.format(replace)} instead.`
46-
notes.push(`- ⛔ This rule has been deprecated.${replaceText}`)
45+
lines.push(`> - ⛔ This rule has been deprecated.${replaceText}`)
4746
}
47+
lines.push("", "")
4848

49-
if (notes.length > 0) {
50-
return `${title}\n\n${notes.join("\n")}\n\n`
51-
}
52-
return `${title}\n\n`
49+
return lines.join("\n")
5350
}
5451

5552
/**

0 commit comments

Comments
 (0)