diff --git a/lib/util/check-unsupported-builtins.js b/lib/util/check-unsupported-builtins.js index db2ae46f..2f6e5a6f 100644 --- a/lib/util/check-unsupported-builtins.js +++ b/lib/util/check-unsupported-builtins.js @@ -42,7 +42,7 @@ function isSupported({ supported }, configured) { ...supported.map( version => `>= ${version} < ${major(version) + 1}` ), - `> ${major(latest)}`, + `>= ${latest}`, ].join("||") ) diff --git a/tests/lib/rules/no-unsupported-features/node-builtins.js b/tests/lib/rules/no-unsupported-features/node-builtins.js index ad0de17d..0eb9249c 100644 --- a/tests/lib/rules/no-unsupported-features/node-builtins.js +++ b/tests/lib/rules/no-unsupported-features/node-builtins.js @@ -5305,6 +5305,12 @@ new RuleTester({ languageOptions: { sourceType: "module" } }).run( node: { version: "12.11.0" }, }, }, + + // https://github.com/eslint-community/eslint-plugin-n/issues/253 + { + code: `fetch("/api/xxx");`, + settings: { node: { version: ">=18.2.0" } }, + }, ], invalid: [ {