File tree Expand file tree Collapse file tree
lib/rules/no-unsupported-features
tests/lib/rules/no-unsupported-features Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -362,6 +362,16 @@ const features = {
362362 test : info => info . node . type === "Literal" ,
363363 messageId : "no-bigint" ,
364364 } ,
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+ } ,
365375 ] ,
366376 } ,
367377 dynamicImport : {
@@ -615,6 +625,8 @@ module.exports = {
615625 //------------------------------------------------------------------
616626 "no-bigint" :
617627 "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." ,
618630 "no-dynamic-import" :
619631 "'import()' expressions are not supported until Node.js {{supported}}. The configured version range is '{{version}}'." ,
620632 } ,
Original file line number Diff line number Diff line change @@ -2450,6 +2450,14 @@ ruleTester.run(
24502450 code : "var n = new BigUint64Array()" ,
24512451 options : [ { version : "10.3.0" } ] ,
24522452 } ,
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+ } ,
24532461 ] ,
24542462 invalid : [
24552463 {
@@ -2465,6 +2473,32 @@ ruleTester.run(
24652473 } ,
24662474 ] ,
24672475 } ,
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+ } ,
24682502 ] ,
24692503 } ,
24702504 {
You can’t perform that action at this time.
0 commit comments