@@ -22,7 +22,7 @@ Generated by [AVA](https://avajs.dev).
22
22
23
23
`␊
24
24
> 1 | throw Error()␊
25
- | ^^^^^^^ Use \`new\` when throwing an error.␊
25
+ | ^^^^^^^ Use \`new\` when creating an error.␊
26
26
`
27
27
28
28
## invalid(2): throw (Error)()
@@ -43,7 +43,7 @@ Generated by [AVA](https://avajs.dev).
43
43
44
44
`␊
45
45
> 1 | throw (Error)()␊
46
- | ^^^^^^^^^ Use \`new\` when throwing an error.␊
46
+ | ^^^^^^^^^ Use \`new\` when creating an error.␊
47
47
`
48
48
49
49
## invalid(3): throw lib.Error()
@@ -64,7 +64,7 @@ Generated by [AVA](https://avajs.dev).
64
64
65
65
`␊
66
66
> 1 | throw lib.Error()␊
67
- | ^^^^^^^^^^^ Use \`new\` when throwing an error.␊
67
+ | ^^^^^^^^^^^ Use \`new\` when creating an error.␊
68
68
`
69
69
70
70
## invalid(4): throw lib.mod.Error()
@@ -85,7 +85,7 @@ Generated by [AVA](https://avajs.dev).
85
85
86
86
`␊
87
87
> 1 | throw lib.mod.Error()␊
88
- | ^^^^^^^^^^^^^^^ Use \`new\` when throwing an error.␊
88
+ | ^^^^^^^^^^^^^^^ Use \`new\` when creating an error.␊
89
89
`
90
90
91
91
## invalid(5): throw lib[ mod] .Error()
@@ -106,7 +106,7 @@ Generated by [AVA](https://avajs.dev).
106
106
107
107
`␊
108
108
> 1 | throw lib[mod].Error()␊
109
- | ^^^^^^^^^^^^^^^^ Use \`new\` when throwing an error.␊
109
+ | ^^^^^^^^^^^^^^^^ Use \`new\` when creating an error.␊
110
110
`
111
111
112
112
## invalid(6): throw (lib.mod).Error()
@@ -127,7 +127,7 @@ Generated by [AVA](https://avajs.dev).
127
127
128
128
`␊
129
129
> 1 | throw (lib.mod).Error()␊
130
- | ^^^^^^^^^^^^^^^^^ Use \`new\` when throwing an error.␊
130
+ | ^^^^^^^^^^^^^^^^^ Use \`new\` when creating an error.␊
131
131
`
132
132
133
133
## invalid(7): throw Error('foo')
@@ -148,7 +148,7 @@ Generated by [AVA](https://avajs.dev).
148
148
149
149
`␊
150
150
> 1 | throw Error('foo')␊
151
- | ^^^^^^^^^^^^ Use \`new\` when throwing an error.␊
151
+ | ^^^^^^^^^^^^ Use \`new\` when creating an error.␊
152
152
`
153
153
154
154
## invalid(8): throw CustomError('foo')
@@ -169,7 +169,7 @@ Generated by [AVA](https://avajs.dev).
169
169
170
170
`␊
171
171
> 1 | throw CustomError('foo')␊
172
- | ^^^^^^^^^^^^^^^^^^ Use \`new\` when throwing an error.␊
172
+ | ^^^^^^^^^^^^^^^^^^ Use \`new\` when creating an error.␊
173
173
`
174
174
175
175
## invalid(9): throw FooBarBazError('foo')
@@ -190,7 +190,7 @@ Generated by [AVA](https://avajs.dev).
190
190
191
191
`␊
192
192
> 1 | throw FooBarBazError('foo')␊
193
- | ^^^^^^^^^^^^^^^^^^^^^ Use \`new\` when throwing an error.␊
193
+ | ^^^^^^^^^^^^^^^^^^^^^ Use \`new\` when creating an error.␊
194
194
`
195
195
196
196
## invalid(10): throw ABCError('foo')
@@ -211,7 +211,7 @@ Generated by [AVA](https://avajs.dev).
211
211
212
212
`␊
213
213
> 1 | throw ABCError('foo')␊
214
- | ^^^^^^^^^^^^^^^ Use \`new\` when throwing an error.␊
214
+ | ^^^^^^^^^^^^^^^ Use \`new\` when creating an error.␊
215
215
`
216
216
217
217
## invalid(11): throw Abc3Error('foo')
@@ -232,7 +232,7 @@ Generated by [AVA](https://avajs.dev).
232
232
233
233
`␊
234
234
> 1 | throw Abc3Error('foo')␊
235
- | ^^^^^^^^^^^^^^^^ Use \`new\` when throwing an error.␊
235
+ | ^^^^^^^^^^^^^^^^ Use \`new\` when creating an error.␊
236
236
`
237
237
238
238
## invalid(12): throw TypeError()
@@ -253,7 +253,7 @@ Generated by [AVA](https://avajs.dev).
253
253
254
254
`␊
255
255
> 1 | throw TypeError()␊
256
- | ^^^^^^^^^^^ Use \`new\` when throwing an error.␊
256
+ | ^^^^^^^^^^^ Use \`new\` when creating an error.␊
257
257
`
258
258
259
259
## invalid(13): throw EvalError()
@@ -274,7 +274,7 @@ Generated by [AVA](https://avajs.dev).
274
274
275
275
`␊
276
276
> 1 | throw EvalError()␊
277
- | ^^^^^^^^^^^ Use \`new\` when throwing an error.␊
277
+ | ^^^^^^^^^^^ Use \`new\` when creating an error.␊
278
278
`
279
279
280
280
## invalid(14): throw RangeError()
@@ -295,7 +295,7 @@ Generated by [AVA](https://avajs.dev).
295
295
296
296
`␊
297
297
> 1 | throw RangeError()␊
298
- | ^^^^^^^^^^^^ Use \`new\` when throwing an error.␊
298
+ | ^^^^^^^^^^^^ Use \`new\` when creating an error.␊
299
299
`
300
300
301
301
## invalid(15): throw ReferenceError()
@@ -316,7 +316,7 @@ Generated by [AVA](https://avajs.dev).
316
316
317
317
`␊
318
318
> 1 | throw ReferenceError()␊
319
- | ^^^^^^^^^^^^^^^^ Use \`new\` when throwing an error.␊
319
+ | ^^^^^^^^^^^^^^^^ Use \`new\` when creating an error.␊
320
320
`
321
321
322
322
## invalid(16): throw SyntaxError()
@@ -337,7 +337,7 @@ Generated by [AVA](https://avajs.dev).
337
337
338
338
`␊
339
339
> 1 | throw SyntaxError()␊
340
- | ^^^^^^^^^^^^^ Use \`new\` when throwing an error.␊
340
+ | ^^^^^^^^^^^^^ Use \`new\` when creating an error.␊
341
341
`
342
342
343
343
## invalid(17): throw URIError()
@@ -358,7 +358,7 @@ Generated by [AVA](https://avajs.dev).
358
358
359
359
`␊
360
360
> 1 | throw URIError()␊
361
- | ^^^^^^^^^^ Use \`new\` when throwing an error.␊
361
+ | ^^^^^^^^^^ Use \`new\` when creating an error.␊
362
362
`
363
363
364
364
## invalid(18): throw (( URIError() ))
@@ -379,7 +379,7 @@ Generated by [AVA](https://avajs.dev).
379
379
380
380
`␊
381
381
> 1 | throw (( URIError() ))␊
382
- | ^^^^^^^^^^ Use \`new\` when throwing an error.␊
382
+ | ^^^^^^^^^^ Use \`new\` when creating an error.␊
383
383
`
384
384
385
385
## invalid(19): throw (( URIError ))()
@@ -400,7 +400,7 @@ Generated by [AVA](https://avajs.dev).
400
400
401
401
`␊
402
402
> 1 | throw (( URIError ))()␊
403
- | ^^^^^^^^^^^^^^^^ Use \`new\` when throwing an error.␊
403
+ | ^^^^^^^^^^^^^^^^ Use \`new\` when creating an error.␊
404
404
`
405
405
406
406
## invalid(20): throw getGlobalThis().Error()
@@ -421,7 +421,7 @@ Generated by [AVA](https://avajs.dev).
421
421
422
422
`␊
423
423
> 1 | throw getGlobalThis().Error()␊
424
- | ^^^^^^^^^^^^^^^^^^^^^^^ Use \`new\` when throwing an error.␊
424
+ | ^^^^^^^^^^^^^^^^^^^^^^^ Use \`new\` when creating an error.␊
425
425
`
426
426
427
427
## invalid(21): throw utils.getGlobalThis().Error()
@@ -442,7 +442,7 @@ Generated by [AVA](https://avajs.dev).
442
442
443
443
`␊
444
444
> 1 | throw utils.getGlobalThis().Error()␊
445
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Use \`new\` when throwing an error.␊
445
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Use \`new\` when creating an error.␊
446
446
`
447
447
448
448
## invalid(22): throw (( getGlobalThis().Error ))()
@@ -463,5 +463,74 @@ Generated by [AVA](https://avajs.dev).
463
463
464
464
`␊
465
465
> 1 | throw (( getGlobalThis().Error ))()␊
466
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Use \`new\` when throwing an error.␊
466
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Use \`new\` when creating an error.␊
467
+ `
468
+
469
+ ## invalid(23): const error = Error()
470
+
471
+ > Input
472
+
473
+ `␊
474
+ 1 | const error = Error()␊
475
+ `
476
+
477
+ > Output
478
+
479
+ `␊
480
+ 1 | const error = new Error()␊
481
+ `
482
+
483
+ > Error 1/1
484
+
485
+ `␊
486
+ > 1 | const error = Error()␊
487
+ | ^^^^^^^ Use \`new\` when creating an error.␊
488
+ `
489
+
490
+ ## invalid(24): throw Object.assign(Error(), {foo})
491
+
492
+ > Input
493
+
494
+ `␊
495
+ 1 | throw Object.assign(Error(), {foo})␊
496
+ `
497
+
498
+ > Output
499
+
500
+ `␊
501
+ 1 | throw Object.assign(new Error(), {foo})␊
502
+ `
503
+
504
+ > Error 1/1
505
+
506
+ `␊
507
+ > 1 | throw Object.assign(Error(), {foo})␊
508
+ | ^^^^^^^ Use \`new\` when creating an error.␊
509
+ `
510
+
511
+ ## invalid(25): new Promise((resolve, reject) => { reject(Error('message')); });
512
+
513
+ > Input
514
+
515
+ `␊
516
+ 1 | new Promise((resolve, reject) => {␊
517
+ 2 | reject(Error('message'));␊
518
+ 3 | });␊
519
+ `
520
+
521
+ > Output
522
+
523
+ `␊
524
+ 1 | new Promise((resolve, reject) => {␊
525
+ 2 | reject(new Error('message'));␊
526
+ 3 | });␊
527
+ `
528
+
529
+ > Error 1/1
530
+
531
+ `␊
532
+ 1 | new Promise((resolve, reject) => {␊
533
+ > 2 | reject(Error('message'));␊
534
+ | ^^^^^^^^^^^^^^^^ Use \`new\` when creating an error.␊
535
+ 3 | });␊
467
536
`
0 commit comments