|
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 | ], |
@@ -435,10 +435,15 @@ function defineVisitor(context, options) { |
435 | 435 | * @returns {boolean} `true` if it's supporting. |
436 | 436 | */ |
437 | 437 | function isNotSupportingVersion(aCase) { |
438 | | - return ( |
439 | | - !aCase.supported || |
440 | | - options.version.intersects(getSemverRange(`<${aCase.supported}`)) |
441 | | - ) |
| 438 | + if (!aCase.supported) { |
| 439 | + return true |
| 440 | + } |
| 441 | + |
| 442 | + if (aCase.supported instanceof Range) { |
| 443 | + return !options.version.intersects(aCase.supported) |
| 444 | + } |
| 445 | + |
| 446 | + return options.version.intersects(getSemverRange(`<${aCase.supported}`)) |
442 | 447 | } |
443 | 448 |
|
444 | 449 | /** |
@@ -628,7 +633,7 @@ module.exports = { |
628 | 633 | "no-bigint-property-names": |
629 | 634 | "Bigint literal property names are not supported yet.", |
630 | 635 | "no-dynamic-import": |
631 | | - "'import()' expressions are not supported yet.", |
| 636 | + "'import()' expressions are not supported until Node.js {{supported}}. The configured version range is '{{version}}'.", |
632 | 637 | }, |
633 | 638 | }, |
634 | 639 | create(context) { |
|
0 commit comments