eslint-plugin-n 15.5.2 → 15.6.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/rules/no-deprecated-api.js +5 -7
- package/lib/rules/no-unsupported-features/es-builtins.js +2 -3
- package/lib/rules/no-unsupported-features/es-syntax.js +2 -5
- package/lib/rules/no-unsupported-features/node-builtins.js +3 -4
- package/lib/util/check-unsupported-builtins.js +1 -2
- package/lib/util/get-configured-node-version.js +24 -2
- package/package.json +1 -1
|
@@ -671,8 +671,7 @@ function toName(type, path) {
|
|
|
671
671
|
*/
|
|
672
672
|
function parseOptions(context) {
|
|
673
673
|
const raw = context.options[0] || {}
|
|
674
|
-
const
|
|
675
|
-
const version = getConfiguredNodeVersion(raw.version, filePath)
|
|
674
|
+
const version = getConfiguredNodeVersion(context)
|
|
676
675
|
const ignoredModuleItems = new Set(raw.ignoreModuleItems || [])
|
|
677
676
|
const ignoredGlobalItems = new Set(raw.ignoreGlobalItems || [])
|
|
678
677
|
|
|
@@ -693,9 +692,7 @@ module.exports = {
|
|
|
693
692
|
{
|
|
694
693
|
type: "object",
|
|
695
694
|
properties: {
|
|
696
|
-
version:
|
|
697
|
-
type: "string",
|
|
698
|
-
},
|
|
695
|
+
version: getConfiguredNodeVersion.schema,
|
|
699
696
|
ignoreModuleItems: {
|
|
700
697
|
type: "array",
|
|
701
698
|
items: {
|
|
@@ -720,8 +717,9 @@ module.exports = {
|
|
|
720
717
|
},
|
|
721
718
|
],
|
|
722
719
|
messages: {
|
|
723
|
-
|
|
724
|
-
|
|
720
|
+
deprecated:
|
|
721
|
+
"{{name}} was deprecated since v{{version}}{{replace}}.",
|
|
722
|
+
},
|
|
725
723
|
},
|
|
726
724
|
create(context) {
|
|
727
725
|
const { ignoredModuleItems, ignoredGlobalItems, version } =
|
|
@@ -10,6 +10,7 @@ const {
|
|
|
10
10
|
messages,
|
|
11
11
|
} = require("../../util/check-unsupported-builtins")
|
|
12
12
|
const enumeratePropertyNames = require("../../util/enumerate-property-names")
|
|
13
|
+
const getConfiguredNodeVersion = require("../../util/get-configured-node-version")
|
|
13
14
|
|
|
14
15
|
const trackMap = {
|
|
15
16
|
globals: {
|
|
@@ -152,9 +153,7 @@ module.exports = {
|
|
|
152
153
|
{
|
|
153
154
|
type: "object",
|
|
154
155
|
properties: {
|
|
155
|
-
version:
|
|
156
|
-
type: "string",
|
|
157
|
-
},
|
|
156
|
+
version: getConfiguredNodeVersion.schema,
|
|
158
157
|
ignores: {
|
|
159
158
|
type: "array",
|
|
160
159
|
items: {
|
|
@@ -412,8 +412,7 @@ const keywords = Object.keys(features)
|
|
|
412
412
|
*/
|
|
413
413
|
function parseOptions(context) {
|
|
414
414
|
const raw = context.options[0] || {}
|
|
415
|
-
const
|
|
416
|
-
const version = getConfiguredNodeVersion(raw.version, filePath)
|
|
415
|
+
const version = getConfiguredNodeVersion(context)
|
|
417
416
|
const ignores = new Set(raw.ignores || [])
|
|
418
417
|
|
|
419
418
|
return Object.freeze({ version, ignores })
|
|
@@ -534,9 +533,7 @@ module.exports = {
|
|
|
534
533
|
{
|
|
535
534
|
type: "object",
|
|
536
535
|
properties: {
|
|
537
|
-
version:
|
|
538
|
-
type: "string",
|
|
539
|
-
},
|
|
536
|
+
version: getConfiguredNodeVersion.schema,
|
|
540
537
|
ignores: {
|
|
541
538
|
type: "array",
|
|
542
539
|
items: {
|
|
@@ -10,6 +10,7 @@ const {
|
|
|
10
10
|
messages,
|
|
11
11
|
} = require("../../util/check-unsupported-builtins")
|
|
12
12
|
const enumeratePropertyNames = require("../../util/enumerate-property-names")
|
|
13
|
+
const getConfiguredNodeVersion = require("../../util/get-configured-node-version")
|
|
13
14
|
|
|
14
15
|
const trackMap = {
|
|
15
16
|
globals: {
|
|
@@ -263,7 +264,7 @@ const trackMap = {
|
|
|
263
264
|
},
|
|
264
265
|
},
|
|
265
266
|
release: { [READ]: { supported: "3.0.0" } },
|
|
266
|
-
report: { [READ]: { supported: "14.0.0", experimental: "11.8.0"} },
|
|
267
|
+
report: { [READ]: { supported: "14.0.0", experimental: "11.8.0" } },
|
|
267
268
|
resourceUsage: { [READ]: { supported: "12.6.0" } },
|
|
268
269
|
setegid: { [READ]: { supported: "2.0.0" } },
|
|
269
270
|
seteuid: { [READ]: { supported: "2.0.0" } },
|
|
@@ -384,9 +385,7 @@ module.exports = {
|
|
|
384
385
|
{
|
|
385
386
|
type: "object",
|
|
386
387
|
properties: {
|
|
387
|
-
version:
|
|
388
|
-
type: "string",
|
|
389
|
-
},
|
|
388
|
+
version: getConfiguredNodeVersion.schema,
|
|
390
389
|
ignores: {
|
|
391
390
|
type: "array",
|
|
392
391
|
items: {
|
|
@@ -23,8 +23,7 @@ const getSemverRange = require("./get-semver-range")
|
|
|
23
23
|
*/
|
|
24
24
|
function parseOptions(context) {
|
|
25
25
|
const raw = context.options[0] || {}
|
|
26
|
-
const
|
|
27
|
-
const version = getConfiguredNodeVersion(raw.version, filePath)
|
|
26
|
+
const version = getConfiguredNodeVersion(context)
|
|
28
27
|
const ignores = new Set(raw.ignores || [])
|
|
29
28
|
|
|
30
29
|
return Object.freeze({ version, ignores })
|
|
@@ -8,6 +8,19 @@ const { Range } = require("semver") //eslint-disable-line no-unused-vars
|
|
|
8
8
|
const getPackageJson = require("./get-package-json")
|
|
9
9
|
const getSemverRange = require("./get-semver-range")
|
|
10
10
|
|
|
11
|
+
/**
|
|
12
|
+
* Gets `version` property from a given option object.
|
|
13
|
+
*
|
|
14
|
+
* @param {object|undefined} option - An option object to get.
|
|
15
|
+
* @returns {string[]|null} The `allowModules` value, or `null`.
|
|
16
|
+
*/
|
|
17
|
+
function get(option) {
|
|
18
|
+
if (option && option.version) {
|
|
19
|
+
return option.version
|
|
20
|
+
}
|
|
21
|
+
return null
|
|
22
|
+
}
|
|
23
|
+
|
|
11
24
|
/**
|
|
12
25
|
* Get the `engines.node` field of package.json.
|
|
13
26
|
* @param {string} filename The path to the current linting file.
|
|
@@ -30,10 +43,19 @@ function getEnginesNode(filename) {
|
|
|
30
43
|
* This will be used to look package.json up if `version` is not a valid version range.
|
|
31
44
|
* @returns {Range} The configured version range.
|
|
32
45
|
*/
|
|
33
|
-
module.exports = function getConfiguredNodeVersion(
|
|
46
|
+
module.exports = function getConfiguredNodeVersion(context) {
|
|
47
|
+
const version =
|
|
48
|
+
get(context.options && context.options[0]) ||
|
|
49
|
+
get(context.settings && (context.settings.n || context.settings.node))
|
|
50
|
+
const filePath = context.getFilename()
|
|
51
|
+
|
|
34
52
|
return (
|
|
35
53
|
getSemverRange(version) ||
|
|
36
|
-
getEnginesNode(
|
|
54
|
+
getEnginesNode(filePath) ||
|
|
37
55
|
getSemverRange(">=8.0.0")
|
|
38
56
|
)
|
|
39
57
|
}
|
|
58
|
+
|
|
59
|
+
module.exports.schema = {
|
|
60
|
+
type: "string",
|
|
61
|
+
}
|