@@ -162,10 +162,36 @@ ruleTester.run("object-shorthand", rule, {
162162 code : "var x = {_0ConstructorFunction: function(){}, a: b}" ,
163163 options : [ "always" , { ignoreConstructors : true } ] ,
164164 } ,
165+ {
166+ // https://github.com/eslint/eslint/issues/21267
167+ code : 'var x = {"ConstructorFunction": function(){}, a: b}' ,
168+ options : [ "always" , { ignoreConstructors : true } ] ,
169+ } ,
170+ {
171+ // https://github.com/eslint/eslint/issues/21267
172+ code : "var x = {'ConstructorFunction': function(){}, a: b}" ,
173+ options : [ "always" , { ignoreConstructors : true } ] ,
174+ } ,
175+ {
176+ code : "var x = {𐐀Foo: function() {}}" ,
177+ options : [ "always" , { ignoreConstructors : true } ] ,
178+ } ,
165179 {
166180 code : "var x = {notConstructorFunction(){}, b: c}" ,
167181 options : [ "always" , { ignoreConstructors : true } ] ,
168182 } ,
183+ {
184+ code : "var x = {[notConstructorFunction](){}, b: c}" ,
185+ options : [ "always" , { ignoreConstructors : true } ] ,
186+ } ,
187+ {
188+ code : "var x = {[NotConstructorFunction](){}, b: c}" ,
189+ options : [ "always" , { ignoreConstructors : true } ] ,
190+ } ,
191+ {
192+ code : "var x = {'.NotConstructorFunction'(){}, b: c}" ,
193+ options : [ "always" , { ignoreConstructors : true } ] ,
194+ } ,
169195 {
170196 code : "var x = {ConstructorFunction: function(){}, a: b}" ,
171197 options : [ "methods" , { ignoreConstructors : true } ] ,
@@ -186,18 +212,58 @@ ruleTester.run("object-shorthand", rule, {
186212 code : "var x = {_0ConstructorFunction: function(){}, a: b}" ,
187213 options : [ "methods" , { ignoreConstructors : true } ] ,
188214 } ,
215+ {
216+ code : 'var x = {"ConstructorFunction": function(){}, a: b}' ,
217+ options : [ "methods" , { ignoreConstructors : true } ] ,
218+ } ,
219+ {
220+ code : "var x = {'ConstructorFunction': function(){}, a: b}" ,
221+ options : [ "methods" , { ignoreConstructors : true } ] ,
222+ } ,
189223 {
190224 code : "var x = {notConstructorFunction(){}, b: c}" ,
191225 options : [ "methods" , { ignoreConstructors : true } ] ,
192226 } ,
227+ {
228+ code : "var x = {[notConstructorFunction](){}, b: c}" ,
229+ options : [ "methods" , { ignoreConstructors : true } ] ,
230+ } ,
231+ {
232+ code : "var x = {[NotConstructorFunction](){}, b: c}" ,
233+ options : [ "methods" , { ignoreConstructors : true } ] ,
234+ } ,
235+ {
236+ code : "var x = {'.NotConstructorFunction'(){}, b: c}" ,
237+ options : [ "methods" , { ignoreConstructors : true } ] ,
238+ } ,
193239 {
194240 code : "var x = {ConstructorFunction: function(){}, a: b}" ,
195241 options : [ "never" ] ,
196242 } ,
243+ {
244+ code : 'var x = {"ConstructorFunction": function(){}, a: b}' ,
245+ options : [ "never" ] ,
246+ } ,
247+ {
248+ code : "var x = {'ConstructorFunction': function(){}, a: b}" ,
249+ options : [ "never" ] ,
250+ } ,
197251 {
198252 code : "var x = {notConstructorFunction: function(){}, b: c}" ,
199253 options : [ "never" ] ,
200254 } ,
255+ {
256+ code : "var x = {[notConstructorFunction]: function(){}, b: c}" ,
257+ options : [ "never" ] ,
258+ } ,
259+ {
260+ code : "var x = {[NotConstructorFunction]: function(){}, b: c}" ,
261+ options : [ "never" ] ,
262+ } ,
263+ {
264+ code : "var x = {'.NotConstructorFunction': function(){}, b: c}" ,
265+ options : [ "never" ] ,
266+ } ,
201267
202268 // methodsIgnorePattern
203269 {
@@ -910,6 +976,40 @@ ruleTester.run("object-shorthand", rule, {
910976 options : [ "methods" , { ignoreConstructors : true } ] ,
911977 errors : [ METHOD_ERROR ] ,
912978 } ,
979+ // https://github.com/eslint/eslint/pull/21271#discussion_r3889188639
980+ {
981+ code : "var x = {[y]: function() {}}" ,
982+ output : "var x = {[y]() {}}" ,
983+ options : [ "methods" , { ignoreConstructors : true } ] ,
984+ errors : [ METHOD_ERROR ] ,
985+ } ,
986+ // https://github.com/eslint/eslint/pull/21271#discussion_r3889188639
987+ {
988+ code : "var x = {[Y]: function() {}}" ,
989+ output : "var x = {[Y]() {}}" ,
990+ options : [ "methods" , { ignoreConstructors : true } ] ,
991+ errors : [ METHOD_ERROR ] ,
992+ } ,
993+ {
994+ code : "var x = {'.Y': function() {}}" ,
995+ output : "var x = {'.Y'() {}}" ,
996+ options : [ "methods" , { ignoreConstructors : true } ] ,
997+ errors : [ METHOD_ERROR ] ,
998+ } ,
999+ {
1000+ // https://github.com/eslint/eslint/issues/21267
1001+ code : 'var x = {"ConstructorFunction": function() {}, a: b}' ,
1002+ output : 'var x = {"ConstructorFunction"() {}, a: b}' ,
1003+ options : [ "methods" , { ignoreConstructors : false } ] ,
1004+ errors : [ METHOD_ERROR ] ,
1005+ } ,
1006+ {
1007+ // https://github.com/eslint/eslint/issues/21267
1008+ code : "var x = {'ConstructorFunction': function() {}, a: b}" ,
1009+ output : "var x = {'ConstructorFunction'() {}, a: b}" ,
1010+ options : [ "methods" , { ignoreConstructors : false } ] ,
1011+ errors : [ METHOD_ERROR ] ,
1012+ } ,
9131013
9141014 // methodsIgnorePattern
9151015 {
0 commit comments