eslint-plugin-n 15.5.0 → 15.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md
CHANGED
|
@@ -57,43 +57,41 @@ npm install --save-dev eslint eslint-plugin-n
|
|
|
57
57
|
|
|
58
58
|
<!-- begin auto-generated rules list -->
|
|
59
59
|
|
|
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).\
|
|
64
62
|
🔧 Automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/user-guide/command-line-interface#--fix).\
|
|
65
63
|
❌ Deprecated.
|
|
66
64
|
|
|
67
65
|
### Best Practices
|
|
68
66
|
|
|
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 | ✅ | | |
|
|
72
70
|
|
|
73
71
|
### Possible Errors
|
|
74
72
|
|
|
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 | ✅ | 🔧 | |
|
|
97
95
|
|
|
98
96
|
### Stylistic Issues
|
|
99
97
|
|
|
@@ -124,11 +122,13 @@ npm install --save-dev eslint eslint-plugin-n
|
|
|
124
122
|
|
|
125
123
|
This plugin provides three configs:
|
|
126
124
|
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
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. |
|
|
130
130
|
|
|
131
|
-
|
|
131
|
+
These preset configs:
|
|
132
132
|
|
|
133
133
|
- 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()`.
|
|
134
134
|
- enable plugin rules which are given ✅ in the above table.
|
|
@@ -126,7 +126,7 @@ const features = {
|
|
|
126
126
|
ruleId: "no-modules",
|
|
127
127
|
cases: [
|
|
128
128
|
{
|
|
129
|
-
supported: "13.2
|
|
129
|
+
supported: new Range("^12.17 || >=13.2"),
|
|
130
130
|
messageId: "no-modules",
|
|
131
131
|
},
|
|
132
132
|
],
|
|
@@ -379,7 +379,7 @@ const features = {
|
|
|
379
379
|
ruleId: "no-dynamic-import",
|
|
380
380
|
cases: [
|
|
381
381
|
{
|
|
382
|
-
supported: new Range("
|
|
382
|
+
supported: new Range("^12.17 || >=13.2"),
|
|
383
383
|
messageId: "no-dynamic-import",
|
|
384
384
|
},
|
|
385
385
|
],
|
|
@@ -34,9 +34,19 @@ class Verifier {
|
|
|
34
34
|
mode: "legacy",
|
|
35
35
|
})
|
|
36
36
|
|
|
37
|
+
const modules = {
|
|
38
|
+
...trackMap.modules,
|
|
39
|
+
...Object.fromEntries(
|
|
40
|
+
Object.entries(trackMap.modules).map(([name, value]) => [
|
|
41
|
+
`node:${name}`,
|
|
42
|
+
value,
|
|
43
|
+
])
|
|
44
|
+
),
|
|
45
|
+
}
|
|
46
|
+
|
|
37
47
|
for (const { node } of [
|
|
38
|
-
...tracker.iterateCjsReferences(
|
|
39
|
-
...tracker.iterateEsmReferences(
|
|
48
|
+
...tracker.iterateCjsReferences(modules),
|
|
49
|
+
...tracker.iterateEsmReferences(modules),
|
|
40
50
|
]) {
|
|
41
51
|
context.report({ node, messageId: "preferGlobal" })
|
|
42
52
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-n",
|
|
3
|
-
"version": "15.5.
|
|
3
|
+
"version": "15.5.2",
|
|
4
4
|
"description": "Additional ESLint's rules for Node.js",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=12.22.0"
|
|
@@ -17,31 +17,32 @@
|
|
|
17
17
|
"eslint-plugin-es": "^4.1.0",
|
|
18
18
|
"eslint-utils": "^3.0.0",
|
|
19
19
|
"ignore": "^5.1.1",
|
|
20
|
-
"is-core-module": "^2.
|
|
20
|
+
"is-core-module": "^2.11.0",
|
|
21
21
|
"minimatch": "^3.1.2",
|
|
22
22
|
"resolve": "^1.22.1",
|
|
23
|
-
"semver": "^7.3.
|
|
23
|
+
"semver": "^7.3.8"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
26
|
"codecov": "^3.3.0",
|
|
27
27
|
"esbuild": "^0.14.39",
|
|
28
|
-
"eslint": "^8.
|
|
28
|
+
"eslint": "^8.27.0",
|
|
29
29
|
"eslint-config-prettier": "^8.5.0",
|
|
30
|
-
"eslint-doc-generator": "^0.
|
|
31
|
-
"eslint-plugin-eslint-plugin": "^5.0.
|
|
30
|
+
"eslint-doc-generator": "^1.0.0",
|
|
31
|
+
"eslint-plugin-eslint-plugin": "^5.0.6",
|
|
32
32
|
"eslint-plugin-n": "file:.",
|
|
33
|
-
"fast-glob": "^3.2.
|
|
33
|
+
"fast-glob": "^3.2.12",
|
|
34
34
|
"globals": "^13.17.0",
|
|
35
|
-
"husky": "^8.0.
|
|
35
|
+
"husky": "^8.0.2",
|
|
36
36
|
"import-meta-resolve": "^1.1.1",
|
|
37
37
|
"lint-staged": "^12.4.1",
|
|
38
|
-
"
|
|
38
|
+
"markdownlint-cli": "^0.32.2",
|
|
39
|
+
"mocha": "^10.1.0",
|
|
39
40
|
"npm-run-all": "^4.1.5",
|
|
40
41
|
"nyc": "^15.1.0",
|
|
41
42
|
"opener": "^1.5.1",
|
|
42
43
|
"prettier": "^2.7.1",
|
|
43
44
|
"punycode": "^2.1.1",
|
|
44
|
-
"release-it": "^15.
|
|
45
|
+
"release-it": "^15.5.0",
|
|
45
46
|
"rimraf": "^3.0.2"
|
|
46
47
|
},
|
|
47
48
|
"scripts": {
|
|
@@ -49,25 +50,26 @@
|
|
|
49
50
|
"clean": "rimraf .nyc_output coverage",
|
|
50
51
|
"codecov": "nyc report --reporter text-lcov | codecov --pipe --disable=gcov -t $CODECOV_TOKEN",
|
|
51
52
|
"coverage": "opener ./coverage/lcov-report/index.html",
|
|
53
|
+
"format": "prettier --loglevel warn --write \"**/*.{js,css,md}\"",
|
|
52
54
|
"lint": "npm-run-all \"lint:*\"",
|
|
55
|
+
"lint:docs": "markdownlint \"**/*.md\"",
|
|
53
56
|
"lint:eslint-docs": "npm run update:eslint-docs -- --check",
|
|
54
57
|
"lint:js": "eslint lib scripts tests/lib .eslintrc.js",
|
|
55
58
|
"new": "node scripts/new-rule",
|
|
59
|
+
"postversion": "git push && git push --tags",
|
|
60
|
+
"prepare": "husky install",
|
|
56
61
|
"pretest": "npm run -s lint",
|
|
62
|
+
"preversion": "npm test",
|
|
57
63
|
"test": "nyc npm run -s test:_mocha",
|
|
58
|
-
"test:ci": "nyc npm run -s test:_mocha",
|
|
59
64
|
"test:_mocha": "_mocha \"tests/lib/**/*.js\" --reporter progress --timeout 4000",
|
|
60
|
-
"
|
|
65
|
+
"test:ci": "nyc npm run -s test:_mocha",
|
|
66
|
+
"update:eslint-docs": "eslint-doc-generator --config-emoji recommended-module,☑️ --config-emoji recommended-script,✔️ --rule-list-split meta.docs.category --ignore-config recommended-module --ignore-config recommended-script --url-configs \"https://github.com/eslint-community/eslint-plugin-n#-configs\"",
|
|
61
67
|
"version": "npm run -s build && eslint lib/rules --fix && git add .",
|
|
62
|
-
"
|
|
63
|
-
"watch": "npm run test:_mocha -- --watch --growl",
|
|
64
|
-
"format": "prettier --loglevel warn --write \"**/*.{js,css,md}\"",
|
|
65
|
-
"prepare": "husky install",
|
|
66
|
-
"update:eslint-docs": "eslint-doc-generator --config-emoji recommended-module,☑️ --config-emoji recommended-script,✔️ --split-by meta.docs.category"
|
|
68
|
+
"watch": "npm run test:_mocha -- --watch --growl"
|
|
67
69
|
},
|
|
68
70
|
"repository": {
|
|
69
71
|
"type": "git",
|
|
70
|
-
"url": "git+https://github.com/
|
|
72
|
+
"url": "git+https://github.com/eslint-community/eslint-plugin-n.git"
|
|
71
73
|
},
|
|
72
74
|
"keywords": [
|
|
73
75
|
"eslint",
|
|
@@ -85,9 +87,9 @@
|
|
|
85
87
|
"author": "Toru Nagashima",
|
|
86
88
|
"license": "MIT",
|
|
87
89
|
"bugs": {
|
|
88
|
-
"url": "https://github.com/
|
|
90
|
+
"url": "https://github.com/eslint-community/eslint-plugin-n/issues"
|
|
89
91
|
},
|
|
90
|
-
"homepage": "https://github.com/
|
|
92
|
+
"homepage": "https://github.com/eslint-community/eslint-plugin-n#readme",
|
|
91
93
|
"funding": "https://github.com/sponsors/mysticatea",
|
|
92
94
|
"publishConfig": {
|
|
93
95
|
"access": "public",
|