@@ -17,7 +17,7 @@ const RuleTester = require('eslint').RuleTester
17
17
18
18
const ruleTester = new RuleTester ( {
19
19
parserOptions : {
20
- ecmaVersion : 2018 ,
20
+ ecmaVersion : 2020 ,
21
21
sourceType : 'module'
22
22
}
23
23
} )
@@ -237,6 +237,109 @@ ruleTester.run('require-prop-type-constructor', rule, {
237
237
line : 4
238
238
} ] ,
239
239
parser : require . resolve ( '@typescript-eslint/parser' )
240
+ } ,
241
+ {
242
+ filename : 'LiteralsComponent.vue' ,
243
+ code : `
244
+ export default {
245
+ props: {
246
+ str: 'String',
247
+ str2: 'a',
248
+ emptyStr: '',
249
+ number: 1000,
250
+ binumber: 0b10000000000000000000000000000000,
251
+ hexnumber: 0x123456789ABCDEF,
252
+ exp1: 1E3,
253
+ exp2: 2e6,
254
+ exp3: 0.1e2,
255
+ bigInt: 9007199254740991n,
256
+ boolean: true,
257
+ 'null': null,
258
+ regex: /a/,
259
+ template: \`String\`,
260
+ emptyTemplate: \`\`,
261
+ }
262
+ }
263
+ ` ,
264
+ output : `
265
+ export default {
266
+ props: {
267
+ str: String,
268
+ str2: a,
269
+ emptyStr: '',
270
+ number: 1000,
271
+ binumber: 0b10000000000000000000000000000000,
272
+ hexnumber: 0x123456789ABCDEF,
273
+ exp1: 1E3,
274
+ exp2: 2e6,
275
+ exp3: 0.1e2,
276
+ bigInt: 9007199254740991n,
277
+ boolean: true,
278
+ 'null': null,
279
+ regex: /a/,
280
+ template: String,
281
+ emptyTemplate: \`\`,
282
+ }
283
+ }
284
+ ` ,
285
+ errors : [
286
+ {
287
+ message : 'The "str" property should be a constructor.' ,
288
+ line : 4
289
+ } ,
290
+ {
291
+ message : 'The "str2" property should be a constructor.' ,
292
+ line : 5
293
+ } ,
294
+ {
295
+ message : 'The "emptyStr" property should be a constructor.' ,
296
+ line : 6
297
+ } ,
298
+ {
299
+ message : 'The "number" property should be a constructor.' ,
300
+ line : 7
301
+ } ,
302
+ {
303
+ message : 'The "binumber" property should be a constructor.' ,
304
+ line : 8
305
+ } ,
306
+ {
307
+ message : 'The "hexnumber" property should be a constructor.' ,
308
+ line : 9
309
+ } ,
310
+ {
311
+ message : 'The "exp1" property should be a constructor.' ,
312
+ line : 10
313
+ } ,
314
+ {
315
+ message : 'The "exp2" property should be a constructor.' ,
316
+ line : 11
317
+ } ,
318
+ {
319
+ message : 'The "exp3" property should be a constructor.' ,
320
+ line : 12
321
+ } ,
322
+ {
323
+ message : 'The "bigInt" property should be a constructor.' ,
324
+ line : 13
325
+ } ,
326
+ {
327
+ message : 'The "boolean" property should be a constructor.' ,
328
+ line : 14
329
+ } ,
330
+ {
331
+ message : 'The "regex" property should be a constructor.' ,
332
+ line : 16
333
+ } ,
334
+ {
335
+ message : 'The "template" property should be a constructor.' ,
336
+ line : 17
337
+ } ,
338
+ {
339
+ message : 'The "emptyTemplate" property should be a constructor.' ,
340
+ line : 18
341
+ }
342
+ ]
240
343
}
241
344
]
242
345
} )
0 commit comments