Description
Environment
Node version: v20.12.2
npm version: 10.5.0
ESLint version: 8.57.0
eslint-plugin-n version: 17.2.1
Operating System: macOS
What rule do you want to report?
unsupported-features/node-builtins-modules
Link to Minimal Reproducible Example
What did you expect to happen?
This works fine (expectedly fail),
"n/no-unsupported-features/node-builtins": ["error", {version: "9.0.0"}]
but this doesn't work (unexpectedly success) in v17: demo
"n/no-unsupported-features/node-builtins": ["error", {version: ">=9.0.0"}]
v16 works fine: demo
Participation
- I am willing to submit a pull request for this issue.
Additional comments
Since specifying the version by range is common in the engines field of package.json, this bug is likely to occur in many cases.
However, this is not included in the test cases.
The logic of this range comparison seems to be the cause.
eslint-plugin-n/lib/util/check-unsupported-builtins.js
Lines 40 to 53 in eb11b5b