Skip to content

Commit a4fbb9a

Browse files
committed
πŸ“ update documents
1 parent ab40a47 commit a4fbb9a

37 files changed

+329
-62
lines changed

β€Ždocs/rules/exports-style.md

+8-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
# enforce either `module.exports` or `exports` (exports-style)
1+
# node/exports-style
2+
> enforce either `module.exports` or `exports`
23
34
`module.exports` and `exports` are the same instance by default.
45
But those come to be different if one of them is modified.
@@ -13,7 +14,7 @@ exports.bar = 2
1314

1415
In this case, `exports.bar` will be lost since only the instance of `module.exports` will be exported.
1516

16-
## Rule Details
17+
## πŸ“– Rule Details
1718

1819
This rule enforces the export style.
1920

@@ -104,3 +105,8 @@ module.exports = exports = function foo() {
104105

105106
exports.bar = 1
106107
```
108+
109+
## πŸ”Ž Implementation
110+
111+
- [Rule source](../../lib/rules/exports-style.js)
112+
- [Test source](../../tests/lib/rules/exports-style.js)

β€Ždocs/rules/file-extension-in-import.md

+10-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
# enforce the style of file extensions in `import` declarations (file-extension-in-import)
1+
# node/file-extension-in-import
2+
> 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.
25

36
We can omit file extensions in `import`/`export` declarations.
47

@@ -11,7 +14,7 @@ However, [--experimental-modules](https://medium.com/@nodejs/announcing-a-new-ex
1114

1215
Also, we can import a variety kind of files with bundlers such as Webpack. In the situation, probably explicit file extensions help us to understand code.
1316

14-
## Rule Details
17+
## πŸ“– Rule Details
1518

1619
This rule enforces the style of file extensions in `import`/`export` declarations.
1720

@@ -108,3 +111,8 @@ module.exports = {
108111
}
109112
}
110113
```
114+
115+
## πŸ”Ž Implementation
116+
117+
- [Rule source](../../lib/rules/file-extension-in-import.js)
118+
- [Test source](../../tests/lib/rules/file-extension-in-import.js)

β€Ždocs/rules/no-deprecated-api.md

+10-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
1-
# Disallow deprecated API (no-deprecated-api)
1+
# node/no-deprecated-api
2+
> disallow deprecated APIs
3+
4+
- ⭐️ This rule is included in `plugin:node/recommended` preset.
25

36
Node has many deprecated API.
47
The community is going to remove those API from Node in future, so we should not use those.
58

6-
## Rule Details
9+
## πŸ“– Rule Details
710

811
Examples of :-1: **incorrect** code for this rule:
912

@@ -357,3 +360,8 @@ var Buffer = require("buffer").Buffer;
357360
Buffer = require("another-buffer");
358361
new Buffer(); /*ERROR: 'buffer.Buffer' constructor was deprecated.*/
359362
```
363+
364+
## πŸ”Ž Implementation
365+
366+
- [Rule source](../../lib/rules/no-deprecated-api.js)
367+
- [Test source](../../tests/lib/rules/no-deprecated-api.js)

β€Ždocs/rules/no-extraneous-import.md

+8-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
# Disallow `import` declarations which import extraneous modules (no-extraneous-import)
1+
# node/no-extraneous-import
2+
> disallow `import` declarations which import extraneous modules
23
34
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.
45
This rule disallows `import` declarations of extraneous modules.
56

6-
## Rule Details
7+
## πŸ“– Rule Details
78

89
This rule warns `import` declarations of extraneous modules.
910

@@ -77,3 +78,8 @@ module.exports = {
7778
}
7879
}
7980
```
81+
82+
## πŸ”Ž Implementation
83+
84+
- [Rule source](../../lib/rules/no-extraneous-import.js)
85+
- [Test source](../../tests/lib/rules/no-extraneous-import.js)

β€Ždocs/rules/no-extraneous-require.md

+10-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
1-
# Disallow `require()`s which import extraneous modules (no-extraneous-require)
1+
# node/no-extraneous-require
2+
> disallow `require()` expressions which import extraneous modules
3+
4+
- ⭐️ This rule is included in `plugin:node/recommended` preset.
25

36
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.
47
This rule disallows `require()` of extraneous modules.
58

6-
## Rule Details
9+
## πŸ“– Rule Details
710

811
This rule warns `require()` of extraneous modules.
912

@@ -77,3 +80,8 @@ module.exports = {
7780
}
7881
}
7982
```
83+
84+
## πŸ”Ž Implementation
85+
86+
- [Rule source](../../lib/rules/no-extraneous-require.js)
87+
- [Test source](../../tests/lib/rules/no-extraneous-require.js)

β€Ždocs/rules/no-hide-core-modules.md

+10-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
# Disallow third-party modules which are hiding core modules (node/no-hide-core-modules)
1+
# node/no-hide-core-modules
2+
> disallow third-party modules which are hiding core modules
3+
4+
- β›” This rule has been deprecated.
25

36
**: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).
47

@@ -8,7 +11,7 @@ This might cause unintentional behaviors.
811

912
This rule warns `require()` expressions and `import` declarations if those import a third-party module which has the same name as core modules.
1013

11-
## Rule Details
14+
## πŸ“– Rule Details
1215

1316
:-1: Examples of **incorrect** code for this rule:
1417

@@ -58,3 +61,8 @@ This option would allow all explicit dependencies which are hiding core modules.
5861
If `ignoreIndirectDependencies: true`, if the third-party module which has the same name as a core module does not exist in your `package.json`, this rule ignores it.
5962

6063
This option would allow all implicit dependencies which are hiding core modules.
64+
65+
## πŸ”Ž Implementation
66+
67+
- [Rule source](../../lib/rules/no-hide-core-modules.js)
68+
- [Test source](../../tests/lib/rules/no-hide-core-modules.js)

β€Ždocs/rules/no-missing-import.md

+8-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
# Disallow `import` and `export` declarations for files that don't exist (no-missing-import)
1+
# node/no-missing-import
2+
> disallow `import` declarations which import non-existence modules
23
34
This is similar to [no-missing-require](no-missing-require.md), but this rule handles `import` and `export` declarations.
45

56
: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.
67

7-
## Rule Details
8+
## πŸ“– Rule Details
89

910
This rule checks the file paths of `import` and `export` declarations.
1011
If the file paths don't exist, this reports these.
@@ -97,3 +98,8 @@ module.exports = {
9798
}
9899
}
99100
```
101+
102+
## πŸ”Ž Implementation
103+
104+
- [Rule source](../../lib/rules/no-missing-import.js)
105+
- [Test source](../../tests/lib/rules/no-missing-import.js)

β€Ždocs/rules/no-missing-require.md

+10-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
# Disallow `require()`s for files that don't exist (no-missing-require)
1+
# node/no-missing-require
2+
> disallow `require()` expressions which import non-existence modules
3+
4+
- ⭐️ This rule is included in `plugin:node/recommended` preset.
25

36
Maybe we cannot find typo of import paths until run it, so this rule checks import paths.
47

@@ -7,7 +10,7 @@ Maybe we cannot find typo of import paths until run it, so this rule checks impo
710
const foo = require("./foo");
811
```
912

10-
## Rule Details
13+
## πŸ“– Rule Details
1114

1215
This rule checks the file paths of `require()`s, then reports the path of files which don't exist.
1316

@@ -102,3 +105,8 @@ module.exports = {
102105
}
103106
}
104107
```
108+
109+
## πŸ”Ž Implementation
110+
111+
- [Rule source](../../lib/rules/no-missing-require.js)
112+
- [Test source](../../tests/lib/rules/no-missing-require.js)

β€Ždocs/rules/no-unpublished-bin.md

+10-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
# disallow 'bin' files that npm ignores (no-unpublished-bin)
1+
# node/no-unpublished-bin
2+
> disallow `bin` files that npm ignores
3+
4+
- ⭐️ This rule is included in `plugin:node/recommended` preset.
25

36
We can publish CLI commands by `npm`. It uses `bin` field of `package.json`.
47

@@ -11,7 +14,7 @@ We can publish CLI commands by `npm`. It uses `bin` field of `package.json`.
1114

1215
At this time, if `npm` ignores the file, your package will fail to install.
1316

14-
## Rule Details
17+
## πŸ“– Rule Details
1518

1619
If `npm` ignores the files in `bin` field, this rule warns the files.
1720

@@ -107,3 +110,8 @@ For Example:
107110
}
108111
}
109112
```
113+
114+
## πŸ”Ž Implementation
115+
116+
- [Rule source](../../lib/rules/no-unpublished-bin.js)
117+
- [Test source](../../tests/lib/rules/no-unpublished-bin.js)

β€Ždocs/rules/no-unpublished-import.md

+8-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
# Disallow `import` declarations which import unpublished files/modules (no-unpublished-import)
1+
# node/no-unpublished-import
2+
> disallow `import` declarations which import private modules
23
34
This is similar to [no-unpublished-require](no-unpublished-require.md), but this rule handles `import` declarations.
45

56
: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.
67

7-
## Rule Details
8+
## πŸ“– Rule Details
89

910
If a source code file satisfies all of the following conditions, the file is \*published\*.
1011

@@ -136,3 +137,8 @@ For Example:
136137
}
137138
}
138139
```
140+
141+
## πŸ”Ž Implementation
142+
143+
- [Rule source](../../lib/rules/no-unpublished-import.js)
144+
- [Test source](../../tests/lib/rules/no-unpublished-import.js)

β€Ždocs/rules/no-unpublished-require.md

+10-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
1-
# Disallow `require()` expressions which import unpublished files/modules (no-unpublished-require)
1+
# node/no-unpublished-require
2+
> disallow `require()` expressions which import private modules
3+
4+
- ⭐️ This rule is included in `plugin:node/recommended` preset.
25

36
If a `require()` expression's target is not published, the program works in local, but will not work after published to npm.
47
This rule disallows `require()` expressions of unpublished files/modules.
58

6-
## Rule Details
9+
## πŸ“– Rule Details
710

811
If a source code file satisfies all of the following conditions, the file is \*published\*.
912

@@ -135,3 +138,8 @@ For Example:
135138
}
136139
}
137140
```
141+
142+
## πŸ”Ž Implementation
143+
144+
- [Rule source](../../lib/rules/no-unpublished-require.js)
145+
- [Test source](../../tests/lib/rules/no-unpublished-require.js)

β€Ždocs/rules/no-unsupported-features.md

+10-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
# Disallow unsupported ECMAScript features on the specified version (no-unsupported-features)
1+
# node/no-unsupported-features
2+
> disallow unsupported ECMAScript features on the specified version
3+
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.
25

36
**: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.
47

@@ -8,7 +11,7 @@ This rule reports when you used unsupported ECMAScript 2015-2018 features on the
811
> β€» About ECMAScript 2018, this rule reports only features which have arrived at stage 4 until 2018-02-01.
912
> It needs a major version bump in order to cover newer features.
1013
11-
## Rule Details
14+
## πŸ“– Rule Details
1215

1316
:warning: This rule expects to be used with the following configuration:
1417

@@ -299,3 +302,8 @@ E.g., a use of instance methods.
299302
- http://node.green/
300303

301304
[engines]: https://docs.npmjs.com/files/package.json#engines
305+
306+
## πŸ”Ž Implementation
307+
308+
- [Rule source](../../lib/rules/no-unsupported-features.js)
309+
- [Test source](../../tests/lib/rules/no-unsupported-features.js)

β€Ždocs/rules/no-unsupported-features/es-builtins.md

+10-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
1-
# Disallow unsupported ECMAScript features on the specified version (no-unsupported-features/es-builtins)
1+
# node/no-unsupported-features/es-builtins
2+
> disallow unsupported ECMAScript built-ins on the specified version
3+
4+
- ⭐️ This rule is included in `plugin:node/recommended` preset.
25

36
ECMAScript standard is updating every two months.
47
You can check [node.green](https://node.green/) to know which Node.js version supports each ECMAScript feature.
58

69
This rule reports unsupported ECMAScript built-in variables on the configured Node.js version as lint errors.
710
Editor integrations of ESLint would be useful to know it in real-time.
811

9-
## Rule Details
12+
## πŸ“– Rule Details
1013

1114
### Supported ECMAScript features
1215

@@ -139,3 +142,8 @@ For example:
139142
- New events.
140143

141144
[engines]: https://docs.npmjs.com/files/package.json#engines
145+
146+
## πŸ”Ž Implementation
147+
148+
- [Rule source](../../../lib/rules/no-unsupported-features/es-builtins.js)
149+
- [Test source](../../../tests/lib/rules/no-unsupported-features/es-builtins.js)

β€Ždocs/rules/no-unsupported-features/es-syntax.md

+10-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
1-
# Disallow unsupported ECMAScript syntax on the specified version (no-unsupported-features/es-syntax)
1+
# node/no-unsupported-features/es-syntax
2+
> disallow unsupported ECMAScript syntax on the specified version
3+
4+
- ⭐️ This rule is included in `plugin:node/recommended` preset.
25

36
ECMAScript standard is updating every two months.
47
You can check [node.green](https://node.green/) to know which Node.js version supports each ECMAScript feature.
58

69
This rule reports unsupported ECMAScript syntax on the configured Node.js version as lint errors.
710
Editor integrations of ESLint would be useful to know it in real-time.
811

9-
## Rule Details
12+
## πŸ“– Rule Details
1013

1114
### Supported ECMAScript features
1215

@@ -113,3 +116,8 @@ The `"ignores"` option accepts an array of the following strings.
113116
</details>
114117

115118
[engines]: https://docs.npmjs.com/files/package.json#engines
119+
120+
## πŸ”Ž Implementation
121+
122+
- [Rule source](../../../lib/rules/no-unsupported-features/es-syntax.js)
123+
- [Test source](../../../tests/lib/rules/no-unsupported-features/es-syntax.js)

β€Ždocs/rules/no-unsupported-features/node-builtins.md

+10-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
1-
# Disallow unsupported Node.js built-in APIs on the specified version (no-unsupported-features/node-builtins)
1+
# node/no-unsupported-features/node-builtins
2+
> disallow unsupported Node.js built-in APIs on the specified version
3+
4+
- ⭐️ This rule is included in `plugin:node/recommended` preset.
25

36
Node.js community is improving built-in APIs continuously.
47
You can check [Node.js Documentation](https://nodejs.org/api/) to know which Node.js version supports each Node.js API.
58

69
This rule reports unsupported Node.js built-in APIs on the configured Node.js version as lint errors.
710
Editor integrations of ESLint would be useful to know it in real-time.
811

9-
## Rule Details
12+
## πŸ“– Rule Details
1013

1114
This rule reports APIs of Node.js built-in APIs on the basis of [Node.js v12.0.0 Documentation](https://nodejs.org/docs/v12.0.0/api/).
1215

@@ -319,3 +322,8 @@ For example:
319322
- New events.
320323

321324
[engines]: https://docs.npmjs.com/files/package.json#engines
325+
326+
## πŸ”Ž Implementation
327+
328+
- [Rule source](../../../lib/rules/no-unsupported-features/node-builtins.js)
329+
- [Test source](../../../tests/lib/rules/no-unsupported-features/node-builtins.js)

0 commit comments

Comments
Β (0)