File tree 3 files changed +73
-1
lines changed
lib/rules/no-unsupported-features
tests/lib/rules/no-unsupported-features
3 files changed +73
-1
lines changed Original file line number Diff line number Diff line change @@ -383,6 +383,24 @@ 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
+ } ,
386
404
}
387
405
const keywords = Object . keys ( features )
388
406
@@ -629,6 +647,10 @@ module.exports = {
629
647
"Bigint literal property names are not supported yet." ,
630
648
"no-dynamic-import" :
631
649
"'import()' expressions are not supported yet." ,
650
+ "no-optional-chaining" :
651
+ "Optional chainings are not supported until Node.js {{supported}}. The configured version range is '{{version}}'." ,
652
+ "no-nullish-coalescing-operators" :
653
+ "Nullish coalescing operators are not supported until Node.js {{supported}}. The configured version range is '{{version}}'." ,
632
654
} ,
633
655
} ,
634
656
create ( context ) {
Original file line number Diff line number Diff line change 13
13
"eslint" : " >=5.16.0"
14
14
},
15
15
"dependencies" : {
16
- "eslint-plugin-es" : " ^3.0 .0" ,
16
+ "eslint-plugin-es" : " ^4.1 .0" ,
17
17
"eslint-utils" : " ^2.0.0" ,
18
18
"ignore" : " ^5.1.1" ,
19
19
"minimatch" : " ^3.0.4" ,
Original file line number Diff line number Diff line change @@ -2512,6 +2512,56 @@ ruleTester.run(
2512
2512
} ,
2513
2513
] ,
2514
2514
} ,
2515
+ {
2516
+ keyword : "optionalChaining" ,
2517
+ requiredEcmaVersion : 2020 ,
2518
+ valid : [
2519
+ {
2520
+ code : "foo?.bar;" ,
2521
+ options : [ { version : "14.0.0" } ] ,
2522
+ } ,
2523
+ ] ,
2524
+ invalid : [
2525
+ {
2526
+ code : "foo?.bar" ,
2527
+ options : [ { version : "13.0.0" } ] ,
2528
+ errors : [
2529
+ {
2530
+ messageId : "no-optional-chaining" ,
2531
+ data : {
2532
+ supported : "14.0.0" ,
2533
+ version : "13.0.0" ,
2534
+ } ,
2535
+ } ,
2536
+ ] ,
2537
+ } ,
2538
+ ] ,
2539
+ } ,
2540
+ {
2541
+ keyword : "nullishCoalescingOperators" ,
2542
+ requiredEcmaVersion : 2020 ,
2543
+ valid : [
2544
+ {
2545
+ code : "foo ?? bar;" ,
2546
+ options : [ { version : "14.0.0" } ] ,
2547
+ } ,
2548
+ ] ,
2549
+ invalid : [
2550
+ {
2551
+ code : "foo ?? bar" ,
2552
+ options : [ { version : "13.0.0" } ] ,
2553
+ errors : [
2554
+ {
2555
+ messageId : "no-nullish-coalescing-operators" ,
2556
+ data : {
2557
+ supported : "14.0.0" ,
2558
+ version : "13.0.0" ,
2559
+ } ,
2560
+ } ,
2561
+ ] ,
2562
+ } ,
2563
+ ] ,
2564
+ } ,
2515
2565
2516
2566
//----------------------------------------------------------------------
2517
2567
// MISC
You can’t perform that action at this time.
0 commit comments