File tree 2 files changed +12
-29
lines changed
lib/rules/no-unsupported-features
tests/lib/rules/no-unsupported-features
2 files changed +12
-29
lines changed Original file line number Diff line number Diff line change @@ -383,24 +383,6 @@ const features = {
383
383
} ,
384
384
] ,
385
385
} ,
386
- optionalChaining : {
387
- ruleId : "no-optional-chaining" ,
388
- cases : [
389
- {
390
- supported : "14.0.0" ,
391
- messageId : "no-optional-chaining" ,
392
- } ,
393
- ] ,
394
- } ,
395
- nullishCoalescingOperators : {
396
- ruleId : "no-nullish-coalescing-operators" ,
397
- cases : [
398
- {
399
- supported : "14.0.0" ,
400
- messageId : "no-nullish-coalescing-operators" ,
401
- } ,
402
- ] ,
403
- } ,
404
386
}
405
387
const keywords = Object . keys ( features )
406
388
@@ -646,7 +628,7 @@ module.exports = {
646
628
"no-bigint-property-names" :
647
629
"Bigint literal property names are not supported yet." ,
648
630
"no-dynamic-import" :
649
- "'import()' expressions are not supported yet ." ,
631
+ "'import()' expressions are not supported until Node.js {{supported}}. The configured version range is '{{version}}' ." ,
650
632
"no-optional-chaining" :
651
633
"Optional chainings are not supported until Node.js {{supported}}. The configured version range is '{{version}}'." ,
652
634
"no-nullish-coalescing-operators" :
Original file line number Diff line number Diff line change 7
7
const path = require ( "path" )
8
8
const { Linter, RuleTester } = require ( "eslint" )
9
9
const { builtin } = require ( "globals" )
10
+ const { Range } = require ( "semver" )
10
11
const rule = require ( "../../../../lib/rules/no-unsupported-features/es-syntax" )
11
12
12
13
const ES2020Supported = ( ( ) => {
@@ -2489,27 +2490,27 @@ ruleTester.run(
2489
2490
code : "obj.import(source)" ,
2490
2491
options : [ { version : "12.0.0" } ] ,
2491
2492
} ,
2492
- {
2493
+ ... [ "12.17.0" , "13.2.0" ] . map ( v => ( {
2493
2494
code : "import(source)" ,
2494
- options : [
2495
- { version : "13.1.0" , ignores : [ "dynamicImport" ] } ,
2496
- ] ,
2497
- } ,
2495
+ options : [ { version : v } ] ,
2496
+ } ) ) ,
2498
2497
] ,
2499
2498
invalid : [
2500
- {
2499
+ ... [ "12.16.0" , "13.0.0" , "13.1.0" ] . map ( v => ( {
2501
2500
code : "import(source)" ,
2502
- options : [ { version : "13.3.0" } ] ,
2501
+ options : [ { version : v } ] ,
2503
2502
errors : [
2504
2503
{
2505
2504
messageId : "no-dynamic-import" ,
2506
2505
data : {
2507
- supported : null ,
2508
- version : "13.3.0" ,
2506
+ supported : new Range (
2507
+ ">=12.17 <13 || >=13.2"
2508
+ ) . toString ( ) ,
2509
+ version : v ,
2509
2510
} ,
2510
2511
} ,
2511
2512
] ,
2512
- } ,
2513
+ } ) ) ,
2513
2514
] ,
2514
2515
} ,
2515
2516
{
You can’t perform that action at this time.
0 commit comments