eslint-plugin-n 17.0.0 → 17.1.0
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/lib/configs/recommended-module.js +1 -0
- package/lib/configs/recommended-script.js +1 -0
- package/lib/rules/prefer-node-protocol.js +3 -3
- package/lib/util/extend-trackmap-with-node-prefix.js +2 -4
- package/lib/util/import-target.js +2 -2
- package/lib/util/visit-import.js +2 -2
- package/lib/util/visit-require.js +2 -2
- package/package.json +2 -3
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
"use strict"
|
|
6
6
|
|
|
7
|
-
const
|
|
7
|
+
const { isBuiltin } = require("node:module")
|
|
8
8
|
const getConfiguredNodeVersion = require("../util/get-configured-node-version")
|
|
9
9
|
const getSemverRange = require("../util/get-semver-range")
|
|
10
10
|
const visitImport = require("../util/visit-import")
|
|
@@ -150,8 +150,8 @@ module.exports = {
|
|
|
150
150
|
if (
|
|
151
151
|
typeof value !== "string" ||
|
|
152
152
|
value.startsWith("node:") ||
|
|
153
|
-
!
|
|
154
|
-
!
|
|
153
|
+
!isBuiltin(value) ||
|
|
154
|
+
!isBuiltin(`node:${value}`)
|
|
155
155
|
) {
|
|
156
156
|
continue
|
|
157
157
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict"
|
|
2
2
|
|
|
3
|
-
const
|
|
3
|
+
const { isBuiltin } = require("node:module")
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Extend traceMap.modules with `node:` prefixed modules
|
|
@@ -14,9 +14,7 @@ module.exports = function extendTraceMapWithNodePrefix(modules) {
|
|
|
14
14
|
...Object.fromEntries(
|
|
15
15
|
Object.entries(modules)
|
|
16
16
|
.map(([name, value]) => [`node:${name}`, value])
|
|
17
|
-
.filter(([name]) =>
|
|
18
|
-
isBuiltinModule(/** @type {string} */ (name))
|
|
19
|
-
)
|
|
17
|
+
.filter(([name]) => isBuiltin(/** @type {string} */ (name)))
|
|
20
18
|
),
|
|
21
19
|
}
|
|
22
20
|
return ret
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"use strict"
|
|
6
6
|
|
|
7
7
|
const { resolve } = require("path")
|
|
8
|
-
const
|
|
8
|
+
const { isBuiltin } = require("node:module")
|
|
9
9
|
const resolver = require("enhanced-resolve")
|
|
10
10
|
|
|
11
11
|
const isTypescript = require("./is-typescript")
|
|
@@ -152,7 +152,7 @@ module.exports = class ImportTarget {
|
|
|
152
152
|
return "absolute"
|
|
153
153
|
}
|
|
154
154
|
|
|
155
|
-
if (
|
|
155
|
+
if (isBuiltin(this.name)) {
|
|
156
156
|
return "node"
|
|
157
157
|
}
|
|
158
158
|
|
package/lib/util/visit-import.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"use strict"
|
|
6
6
|
|
|
7
7
|
const path = require("path")
|
|
8
|
-
const
|
|
8
|
+
const { isBuiltin } = require("node:module")
|
|
9
9
|
const getResolvePaths = require("./get-resolve-paths")
|
|
10
10
|
const getTryExtensions = require("./get-try-extensions")
|
|
11
11
|
const ImportTarget = require("./import-target")
|
|
@@ -58,7 +58,7 @@ module.exports = function visitImport(
|
|
|
58
58
|
}
|
|
59
59
|
|
|
60
60
|
const name = stripImportPathParams(node.source?.value)
|
|
61
|
-
if (includeCore === true ||
|
|
61
|
+
if (includeCore === true || isBuiltin(name) === false) {
|
|
62
62
|
targets.push(
|
|
63
63
|
new ImportTarget(context, node.source, name, options, "import")
|
|
64
64
|
)
|
|
@@ -10,7 +10,7 @@ const {
|
|
|
10
10
|
ReferenceTracker,
|
|
11
11
|
getStringIfConstant,
|
|
12
12
|
} = require("@eslint-community/eslint-utils")
|
|
13
|
-
const
|
|
13
|
+
const { isBuiltin } = require("node:module")
|
|
14
14
|
const getResolvePaths = require("./get-resolve-paths")
|
|
15
15
|
const getTryExtensions = require("./get-try-extensions")
|
|
16
16
|
const ImportTarget = require("./import-target")
|
|
@@ -70,7 +70,7 @@ module.exports = function visitRequire(
|
|
|
70
70
|
}
|
|
71
71
|
|
|
72
72
|
const name = stripImportPathParams(rawName)
|
|
73
|
-
if (includeCore || !
|
|
73
|
+
if (includeCore || !isBuiltin(name)) {
|
|
74
74
|
targets.push(
|
|
75
75
|
new ImportTarget(
|
|
76
76
|
context,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-n",
|
|
3
|
-
"version": "17.
|
|
3
|
+
"version": "17.1.0",
|
|
4
4
|
"description": "Additional ESLint's rules for Node.js",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
|
|
@@ -22,13 +22,12 @@
|
|
|
22
22
|
"get-tsconfig": "^4.7.0",
|
|
23
23
|
"globals": "^14.0.0",
|
|
24
24
|
"ignore": "^5.2.4",
|
|
25
|
-
"is-builtin-module": "^3.2.1",
|
|
26
25
|
"minimatch": "^9.0.0",
|
|
27
26
|
"semver": "^7.5.3"
|
|
28
27
|
},
|
|
29
28
|
"devDependencies": {
|
|
30
29
|
"@eslint/js": "^9.0.0",
|
|
31
|
-
"@types/eslint": "^8.56.
|
|
30
|
+
"@types/eslint": "^8.56.7",
|
|
32
31
|
"@types/estree": "^1.0.5",
|
|
33
32
|
"@types/node": "^20.11.0",
|
|
34
33
|
"@typescript-eslint/parser": "^7.0.0",
|