File tree 2 files changed +46
-0
lines changed
lib/rules/no-unsupported-features
tests/lib/rules/no-unsupported-features
2 files changed +46
-0
lines changed Original file line number Diff line number Diff line change @@ -362,6 +362,16 @@ const features = {
362
362
test : info => info . node . type === "Literal" ,
363
363
messageId : "no-bigint" ,
364
364
} ,
365
+ {
366
+ supported : null ,
367
+ test : ( { node } ) =>
368
+ node . type === "Literal" &&
369
+ ( node . parent . type === "Property" ||
370
+ node . parent . type === "MethodDefinition" ) &&
371
+ ! node . parent . computed &&
372
+ node . parent . key === node ,
373
+ messageId : "no-bigint-property-names" ,
374
+ } ,
365
375
] ,
366
376
} ,
367
377
dynamicImport : {
@@ -615,6 +625,8 @@ module.exports = {
615
625
//------------------------------------------------------------------
616
626
"no-bigint" :
617
627
"Bigint literals are not supported until Node.js {{supported}}. The configured version range is '{{version}}'." ,
628
+ "no-bigint-property-names" :
629
+ "Bigint literal property names are not supported yet." ,
618
630
"no-dynamic-import" :
619
631
"'import()' expressions are not supported until Node.js {{supported}}. The configured version range is '{{version}}'." ,
620
632
} ,
Original file line number Diff line number Diff line change @@ -2450,6 +2450,14 @@ ruleTester.run(
2450
2450
code : "var n = new BigUint64Array()" ,
2451
2451
options : [ { version : "10.3.0" } ] ,
2452
2452
} ,
2453
+ {
2454
+ code : "var n = { [0n]: 0 }" ,
2455
+ options : [ { version : "10.4.0" } ] ,
2456
+ } ,
2457
+ {
2458
+ code : "var n = class { [0n]() {} }" ,
2459
+ options : [ { version : "10.4.0" } ] ,
2460
+ } ,
2453
2461
] ,
2454
2462
invalid : [
2455
2463
{
@@ -2465,6 +2473,32 @@ ruleTester.run(
2465
2473
} ,
2466
2474
] ,
2467
2475
} ,
2476
+ {
2477
+ code : "var n = { 0n: 0 }" ,
2478
+ options : [ { version : "12.0.0" } ] ,
2479
+ errors : [
2480
+ {
2481
+ messageId : "no-bigint-property-names" ,
2482
+ data : {
2483
+ supported : null ,
2484
+ version : "12.0.0" ,
2485
+ } ,
2486
+ } ,
2487
+ ] ,
2488
+ } ,
2489
+ {
2490
+ code : "var n = class { 0n() {} }" ,
2491
+ options : [ { version : "12.0.0" } ] ,
2492
+ errors : [
2493
+ {
2494
+ messageId : "no-bigint-property-names" ,
2495
+ data : {
2496
+ supported : null ,
2497
+ version : "12.0.0" ,
2498
+ } ,
2499
+ } ,
2500
+ ] ,
2501
+ } ,
2468
2502
] ,
2469
2503
} ,
2470
2504
{
You can’t perform that action at this time.
0 commit comments