File tree Expand file tree Collapse file tree 3 files changed +73
-1
lines changed
lib/rules/no-unsupported-features
tests/lib/rules/no-unsupported-features Expand file tree Collapse file tree 3 files changed +73
-1
lines changed Original file line number Diff line number Diff line change @@ -383,6 +383,24 @@ const features = {
383383 } ,
384384 ] ,
385385 } ,
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+ } ,
386404}
387405const keywords = Object . keys ( features )
388406
@@ -629,6 +647,10 @@ module.exports = {
629647 "Bigint literal property names are not supported yet." ,
630648 "no-dynamic-import" :
631649 "'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}}'." ,
632654 } ,
633655 } ,
634656 create ( context ) {
Original file line number Diff line number Diff line change 1313 "eslint" : " >=5.16.0"
1414 },
1515 "dependencies" : {
16- "eslint-plugin-es" : " ^3.0 .0" ,
16+ "eslint-plugin-es" : " ^4.1 .0" ,
1717 "eslint-utils" : " ^2.0.0" ,
1818 "ignore" : " ^5.1.1" ,
1919 "minimatch" : " ^3.0.4" ,
Original file line number Diff line number Diff line change @@ -2512,6 +2512,56 @@ ruleTester.run(
25122512 } ,
25132513 ] ,
25142514 } ,
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+ } ,
25152565
25162566 //----------------------------------------------------------------------
25172567 // MISC
You can’t perform that action at this time.
0 commit comments