Skip to content

Commit 528282a

Browse files
committed
📝 update decuments
1 parent 9243079 commit 528282a

File tree

9 files changed

+26
-16
lines changed

9 files changed

+26
-16
lines changed

README.md

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,14 @@ $ npm install --save-dev eslint eslint-plugin-node
2929
],
3030
"rules": {
3131
"node/exports-style": ["error", "module.exports"],
32+
"node/file-extension-in-import": ["error", "always"],
3233
"node/prefer-global/buffer": ["error", "always"],
3334
"node/prefer-global/console": ["error", "always"],
3435
"node/prefer-global/process": ["error", "always"],
3536
"node/prefer-global/url-search-params": ["error", "always"],
36-
"node/prefer-global/url": ["error", "always"]
37+
"node/prefer-global/url": ["error", "always"],
38+
"node/prefer-promises/dns": "error",
39+
"node/prefer-promises/fs": "error"
3740
}
3841
}
3942
```
@@ -44,6 +47,7 @@ $ npm install --save-dev eslint eslint-plugin-node
4447
{
4548
"name": "your-module",
4649
"version": "1.0.0",
50+
"type": "commonjs",
4751
"engines": {
4852
"node": ">=8.10.0"
4953
}
@@ -60,18 +64,18 @@ $ npm install --save-dev eslint eslint-plugin-node
6064

6165
| Rule ID | Description | |
6266
|:--------|:------------|:--:|
63-
| [node/no-extraneous-import](./docs/rules/no-extraneous-import.md) | disallow `import` declarations of extraneous packages | |
64-
| [node/no-extraneous-require](./docs/rules/no-extraneous-require.md) | disallow `require()` expressions of extraneous packages | ⭐️ |
65-
| [node/no-missing-import](./docs/rules/no-missing-import.md) | disallow `import` declarations of missing files | |
66-
| [node/no-missing-require](./docs/rules/no-missing-require.md) | disallow `require()` expressions of missing files | ⭐️ |
67-
| [node/no-unpublished-bin](./docs/rules/no-unpublished-bin.md) | disallow 'bin' files which are ignored by npm | ⭐️ |
68-
| [node/no-unpublished-import](./docs/rules/no-unpublished-import.md) | disallow `import` declarations of private things | |
69-
| [node/no-unpublished-require](./docs/rules/no-unpublished-require.md) | disallow `require()` expressions of private things | ⭐️ |
67+
| [node/no-extraneous-import](./docs/rules/no-extraneous-import.md) | disallow `import` declarations which import extraneous modules | ⭐️ |
68+
| [node/no-extraneous-require](./docs/rules/no-extraneous-require.md) | disallow `require()` expressions which import extraneous modules | ⭐️ |
69+
| [node/no-missing-import](./docs/rules/no-missing-import.md) | disallow `import` declarations which import non-existence modules | ⭐️ |
70+
| [node/no-missing-require](./docs/rules/no-missing-require.md) | disallow `require()` expressions which import non-existence modules | ⭐️ |
71+
| [node/no-unpublished-bin](./docs/rules/no-unpublished-bin.md) | disallow `bin` files that npm ignores | ⭐️ |
72+
| [node/no-unpublished-import](./docs/rules/no-unpublished-import.md) | disallow `import` declarations which import private modules | ⭐️ |
73+
| [node/no-unpublished-require](./docs/rules/no-unpublished-require.md) | disallow `require()` expressions which import private modules | ⭐️ |
7074
| [node/no-unsupported-features/es-builtins](./docs/rules/no-unsupported-features/es-builtins.md) | disallow unsupported ECMAScript built-ins on the specified version | ⭐️ |
7175
| [node/no-unsupported-features/es-syntax](./docs/rules/no-unsupported-features/es-syntax.md) | disallow unsupported ECMAScript syntax on the specified version | ⭐️ |
7276
| [node/no-unsupported-features/node-builtins](./docs/rules/no-unsupported-features/node-builtins.md) | disallow unsupported Node.js built-in APIs on the specified version | ⭐️ |
7377
| [node/process-exit-as-throw](./docs/rules/process-exit-as-throw.md) | make `process.exit()` expressions the same code path as `throw` | ⭐️ |
74-
| [node/shebang](./docs/rules/shebang.md) | enforce the correct usage of shebang | ⭐️✒️ |
78+
| [node/shebang](./docs/rules/shebang.md) | suggest correct usage of shebang | ⭐️✒️ |
7579

7680
### Best Practices
7781

@@ -102,7 +106,7 @@ These rules have been deprecated in accordance with the [deprecation policy](htt
102106
| Rule ID | Replaced by |
103107
|:--------|:------------|
104108
| [node/no-hide-core-modules](./docs/rules/no-hide-core-modules.md) | (nothing) |
105-
| [node/no-unsupported-features](./docs/rules/no-unsupported-features.md) | [node/no-unsupported-features/es-syntax](./docs/rules/no-unsupported-features/es-syntax.md) and [node/no-unsupported-features/es-builtins](./docs/rules/no-unsupported-features/es-builtins.md) |
109+
| [node/no-unsupported-features](./docs/rules/no-unsupported-features.md) | [node/node/no-unsupported-features/es-syntax](./docs/rules/node/no-unsupported-features/es-syntax.md) and [node/node/no-unsupported-features/es-builtins](./docs/rules/node/no-unsupported-features/es-builtins.md) |
106110

107111
<!--RULES_TABLE_END-->
108112

docs/rules/no-extraneous-import.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# node/no-extraneous-import
22
> disallow `import` declarations which import extraneous modules
33
4+
- ⭐️ This rule is included in `plugin:node/recommended` preset.
5+
46
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.
57
This rule disallows `import` declarations of extraneous modules.
68

docs/rules/no-missing-import.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# node/no-missing-import
22
> disallow `import` declarations which import non-existence modules
33
4+
- ⭐️ This rule is included in `plugin:node/recommended` preset.
5+
46
This is similar to [no-missing-require](no-missing-require.md), but this rule handles `import` and `export` declarations.
57

68
:warning: ECMAScript 2015 (ES6) does not define the lookup logic and Node does not support modules yet. So this rule spec might be changed in future.

docs/rules/no-unpublished-import.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# node/no-unpublished-import
22
> disallow `import` declarations which import private modules
33
4+
- ⭐️ This rule is included in `plugin:node/recommended` preset.
5+
46
This is similar to [no-unpublished-require](no-unpublished-require.md), but this rule handles `import` declarations.
57

68
:warning: ECMAScript 2015 (ES6) does not define the lookup logic and Node does not support modules yet. So this rule spec might be changed in future.

docs/rules/no-unsupported-features.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# node/no-unsupported-features
22
> disallow unsupported ECMAScript features on the specified version
33
4-
- ⛔ This rule has been deprecated. Use [node/no-unsupported-features/es-syntax](./node/no-unsupported-features/es-syntax.md) and [node/no-unsupported-features/es-builtins](./node/no-unsupported-features/es-builtins.md) instead.
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.
55

66
**: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.
77

lib/rules/no-extraneous-import.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ module.exports = {
1717
description:
1818
"disallow `import` declarations which import extraneous modules",
1919
category: "Possible Errors",
20-
recommended: false,
20+
recommended: true,
2121
url:
2222
"https://github.com/mysticatea/eslint-plugin-node/blob/v8.0.1/docs/rules/no-extraneous-import.md",
2323
},

lib/rules/no-missing-import.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ module.exports = {
1616
description:
1717
"disallow `import` declarations which import non-existence modules",
1818
category: "Possible Errors",
19-
recommended: false,
19+
recommended: true,
2020
url:
2121
"https://github.com/mysticatea/eslint-plugin-node/blob/v8.0.1/docs/rules/no-missing-import.md",
2222
},

lib/rules/no-unpublished-import.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ module.exports = {
1717
description:
1818
"disallow `import` declarations which import private modules",
1919
category: "Possible Errors",
20-
recommended: false,
20+
recommended: true,
2121
url:
2222
"https://github.com/mysticatea/eslint-plugin-node/blob/v8.0.1/docs/rules/no-unpublished-import.md",
2323
},

scripts/update-docs-header-and-footer.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ function renderHeader(rule) {
3737
}
3838
if (rule.deprecated) {
3939
const replace = rule.replacedBy.map(
40-
ruleId => `[${ruleId}](./${ruleId}.md)`
40+
ruleId => `[${ruleId}](./${ruleId.replace("node/", "")}.md)`
4141
)
4242
const replaceText =
4343
replace.length === 0
@@ -73,7 +73,7 @@ for (const rule of rules) {
7373
const filePath = path.resolve(docsRoot, `${rule.name}.md`)
7474
const original = fs.readFileSync(filePath, "utf8")
7575
const body = original.replace(headerPattern, "").replace(footerPattern, "")
76-
const content = `${renderHeader(rule)}${body}${renderFooter(rule)}`
76+
const content = `${renderHeader(rule)}${body}${renderFooter(rule)}\n`
7777

7878
fs.writeFileSync(filePath, content)
7979
}

0 commit comments

Comments
 (0)