eslint-plugin-n 17.3.0 → 17.4.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.
@@ -16,11 +16,7 @@ const getSemverRange = require("../util/get-semver-range")
16
16
  const extendTrackmapWithNodePrefix = require("../util/extend-trackmap-with-node-prefix")
17
17
  const unprefixNodeColon = require("../util/unprefix-node-colon")
18
18
 
19
- /**
20
- * @typedef DeprecatedInfo
21
- * @property {string} since
22
- * @property {string|{ name: string, supported: string }[]|null} replacedBy
23
- */
19
+ /** @typedef {import('../unsupported-features/types.js').DeprecatedInfo} DeprecatedInfo */
24
20
  /**
25
21
  * @typedef ParsedOptions
26
22
  * @property {import('semver').Range} version
@@ -626,7 +622,7 @@ const globals = {
626
622
  },
627
623
  Intl: {
628
624
  v8BreakIterator: {
629
- [READ]: { since: "7.0.0", replacedBy: null },
625
+ [READ]: { since: "7.0.0", replacedBy: null, removed: "9.0.0" },
630
626
  },
631
627
  },
632
628
  require: {
@@ -745,6 +741,8 @@ module.exports = {
745
741
  messages: {
746
742
  deprecated:
747
743
  "{{name}} was deprecated since v{{version}}{{replace}}.",
744
+ removed:
745
+ "{{name}} was deprecated since v{{version}}, and removed in v{{removed}}.",
748
746
  },
749
747
  },
750
748
  create(context) {
@@ -760,17 +758,21 @@ module.exports = {
760
758
  * @returns {void}
761
759
  */
762
760
  function reportItem(node, name, info) {
761
+ const messageId = info.removed ? "removed" : "deprecated"
762
+ const data = {
763
+ name,
764
+ version: info.since,
765
+ removed: info.removed || "",
766
+ replace: toReplaceMessage(info.replacedBy, version),
767
+ }
768
+
763
769
  context.report({
764
770
  node,
765
771
  loc: /** @type {NonNullable<import('estree').Node["loc"]>} */ (
766
772
  node.loc
767
773
  ),
768
- messageId: "deprecated",
769
- data: {
770
- name,
771
- version: info.since,
772
- replace: toReplaceMessage(info.replacedBy, version),
773
- },
774
+ messageId,
775
+ data,
774
776
  })
775
777
  }
776
778
 
@@ -17,8 +17,9 @@
17
17
 
18
18
  /**
19
19
  * @typedef DeprecatedInfo
20
- * @property {string} since
21
- * @property {string|{ name: string, supported: string }[]|null} replacedBy
20
+ * @property {string} since the version when the API was deprecated.
21
+ * @property {string|{ name: string, supported: string }[]|null} replacedBy the text of substitute way.
22
+ * @property {string} [removed] the version when the API was removed.
22
23
  */
23
24
 
24
25
  /** @typedef {import('@eslint-community/eslint-utils').TraceMap<DeprecatedInfo>} DeprecatedInfoTraceMap */
@@ -4,7 +4,7 @@
4
4
  */
5
5
  "use strict"
6
6
 
7
- const { major, rsort } = require("semver")
7
+ const { rsort } = require("semver")
8
8
  const { ReferenceTracker } = require("@eslint-community/eslint-utils")
9
9
  const getConfiguredNodeVersion = require("./get-configured-node-version")
10
10
  const getSemverRange = require("./get-semver-range")
@@ -39,12 +39,7 @@ function isSupported({ supported }, configured) {
39
39
 
40
40
  const [latest] = rsort(supported)
41
41
  const range = getSemverRange(
42
- [
43
- ...supported.map(
44
- version => `>= ${version} < ${major(version) + 1}`
45
- ),
46
- `> ${major(latest)}`,
47
- ].join("||")
42
+ [...supported.map(version => `^${version}`), `>= ${latest}`].join("||")
48
43
  )
49
44
 
50
45
  if (range == null) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-n",
3
- "version": "17.3.0",
3
+ "version": "17.4.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"