From 62d4aef99988ed23ebff8c0c62edb966776e62e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=94=AF=E7=84=B6?= Date: Mon, 29 Apr 2024 03:20:16 +0800 Subject: [PATCH] fix: unsupported-features/node-builtins-modules https://github.com/eslint-community/eslint-plugin-n/issues/250 --- lib/util/check-unsupported-builtins.js | 2 +- tests/lib/rules/no-unsupported-features/node-builtins.js | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) 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: [ {