|
6 | 6 |
|
7 | 7 | const { rules: esRules } = require("eslint-plugin-es") |
8 | 8 | const { getInnermostScope } = require("eslint-utils") |
9 | | -const { Range } = require("semver") //eslint-disable-line no-unused-vars |
| 9 | +const { Range } = require("semver") |
10 | 10 | const getConfiguredNodeVersion = require("../../util/get-configured-node-version") |
11 | 11 | const getSemverRange = require("../../util/get-semver-range") |
12 | 12 | const mergeVisitorsInPlace = require("../../util/merge-visitors-in-place") |
@@ -378,7 +378,7 @@ const features = { |
378 | 378 | ruleId: "no-dynamic-import", |
379 | 379 | cases: [ |
380 | 380 | { |
381 | | - supported: null, |
| 381 | + supported: new Range(">=12.17 <13 || >=13.2"), |
382 | 382 | messageId: "no-dynamic-import", |
383 | 383 | }, |
384 | 384 | ], |
@@ -453,10 +453,15 @@ function defineVisitor(context, options) { |
453 | 453 | * @returns {boolean} `true` if it's supporting. |
454 | 454 | */ |
455 | 455 | function isNotSupportingVersion(aCase) { |
456 | | - return ( |
457 | | - !aCase.supported || |
458 | | - options.version.intersects(getSemverRange(`<${aCase.supported}`)) |
459 | | - ) |
| 456 | + if (!aCase.supported) { |
| 457 | + return true |
| 458 | + } |
| 459 | + |
| 460 | + if (aCase.supported instanceof Range) { |
| 461 | + return !options.version.intersects(aCase.supported) |
| 462 | + } |
| 463 | + |
| 464 | + return options.version.intersects(getSemverRange(`<${aCase.supported}`)) |
460 | 465 | } |
461 | 466 |
|
462 | 467 | /** |
@@ -645,7 +650,7 @@ module.exports = { |
645 | 650 | "no-bigint-property-names": |
646 | 651 | "Bigint literal property names are not supported yet.", |
647 | 652 | "no-dynamic-import": |
648 | | - "'import()' expressions are not supported yet.", |
| 653 | + "'import()' expressions are not supported until Node.js {{supported}}. The configured version range is '{{version}}'.", |
649 | 654 | "no-optional-chaining": |
650 | 655 | "Optional chainings are not supported until Node.js {{supported}}. The configured version range is '{{version}}'.", |
651 | 656 | "no-nullish-coalescing-operators": |
|
0 commit comments