Skip to content

Commit

Permalink
Reapply "fix: unsupported-features/node-builtins-modules range compar…
Browse files Browse the repository at this point in the history
…e" (#254)

This reverts commit caecf3e.
  • Loading branch information
aladdin-add committed Apr 29, 2024
1 parent 62d4aef commit d0f6e7f
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/util/check-unsupported-builtins.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const { ReferenceTracker } = require("@eslint-community/eslint-utils")
const getConfiguredNodeVersion = require("./get-configured-node-version")
const getSemverRange = require("./get-semver-range")
const unprefixNodeColon = require("./unprefix-node-colon")
const semverRangeSubset = require("semver/ranges/subset")

/**
* Parses the options.
Expand Down Expand Up @@ -50,7 +51,7 @@ function isSupported({ supported }, configured) {
return false
}

return configured.intersects(range)
return semverRangeSubset(configured, range)
}

/**
Expand Down
17 changes: 17 additions & 0 deletions tests/lib/rules/no-unsupported-features/es-builtins.js
Original file line number Diff line number Diff line change
Expand Up @@ -2424,6 +2424,23 @@ runTests([
},
],
},
// https://github.com/eslint-community/eslint-plugin-n/issues/250
{
code: "function wrap() { globalThis }",
settings: {
node: { version: ">=11.9.9" },
},
errors: [
{
messageId: "not-supported-till",
data: {
name: "globalThis",
supported: "12.0.0",
version: ">=11.9.9",
},
},
],
},
],
},
])

0 comments on commit d0f6e7f

Please sign in to comment.