You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
-[Buffer constructors](https://nodejs.org/dist/v6.0.0/docs/api/buffer.html#buffer_class_buffer) (You can use [safe-buffer](https://www.npmjs.com/package/safe-buffer) module for `Node@<6.0.0`)
Copy file name to clipboardExpand all lines: docs/rules/no-missing-import.md
+14-20Lines changed: 14 additions & 20 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,45 +2,45 @@
2
2
3
3
This is similar to [no-missing-require](no-missing-require.md), but this rule handles `import` and `export` declarations.
4
4
5
-
**⚠ NOTE:** 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.
5
+
:warning: ECMAScript "error"015 (ES6) does not define the lookup logic and Node does not support modules yet. So this rule spec might be changed in future.
6
6
7
7
## Rule Details
8
8
9
9
This rule checks the file paths of `import` and `export` declarations.
10
10
If the file paths don't exist, this reports these.
11
11
12
-
The following patterns are considered problems:
12
+
Examples of :-1:**incorrect** code for this rule:
13
13
14
14
```js
15
-
/*eslint node/no-missing-import: 2*/
15
+
/*eslint node/no-missing-import: "error" */
16
16
17
-
importtypoFilefrom"./typo-file"; /*error "./typo-file" is not found.*/
18
-
importtypoModulefrom"typo-module"; /*error "typo-module" is not found.*/
17
+
importtypoFilefrom"./typo-file"; /*ERROR: "./typo-file" is not found.*/
18
+
importtypoModulefrom"typo-module"; /*ERROR: "typo-module" is not found.*/
19
19
```
20
20
21
-
The following patterns are not considered problems:
21
+
Examples of :+1:**correct** code for this rule:
22
22
23
23
```js
24
-
/*eslint node/no-missing-import: 2*/
24
+
/*eslint node/no-missing-import: "error" */
25
25
26
26
importexistingFilefrom"./existing-file";
27
27
importexistingModulefrom"existing-module";
28
28
```
29
29
30
-
###Options
30
+
## Options
31
31
32
32
```json
33
33
{
34
34
"rules": {
35
-
"node/no-missing-import": [2, {
35
+
"node/no-missing-import": ["error", {
36
36
"allowModules": [],
37
37
"tryExtensions": [".js", ".json", ".node"]
38
38
}]
39
39
}
40
40
}
41
41
```
42
42
43
-
#### `allowModules`
43
+
###allowModules
44
44
45
45
Some platforms have additional embedded modules.
46
46
For example, Electron has `electron` module.
@@ -51,21 +51,21 @@ This option is an array of strings as module names.
51
51
```json
52
52
{
53
53
"rules": {
54
-
"node/no-missing-import": [2, {
54
+
"node/no-missing-import": ["error", {
55
55
"allowModules": ["electron"]
56
56
}]
57
57
}
58
58
}
59
59
```
60
60
61
-
#### `tryExtensions`
61
+
###tryExtensions
62
62
63
63
When an import path does not exist, this rule checks whether or not any of `path.js`, `path.json`, and `path.node` exists.
64
64
`tryExtensions` option is the extension list this rule uses at the time.
65
65
66
66
Default is `[".js", ".json", ".node"]`.
67
67
68
-
###Shared Settings
68
+
## Shared Settings
69
69
70
70
The following options can be set by [shared settings](http://eslint.org/docs/user-guide/configuring.html#adding-shared-settings).
71
71
Several rules have the same option, but we can set this option at once.
@@ -82,13 +82,7 @@ Several rules have the same option, but we can set this option at once.
82
82
}
83
83
},
84
84
"rules": {
85
-
"node/no-missing-import": 2
85
+
"node/no-missing-import": "error"
86
86
}
87
87
}
88
88
```
89
-
90
-
## When Not To Use It
91
-
92
-
This rule should not be used in ES3/5 environments.
93
-
94
-
If you don't want to be notified about usage of `import` and `export` declarations, then it's safe to disable this rule.
0 commit comments