File tree 1 file changed +7
-11
lines changed
packages/eslint-plugin/docs/rules
1 file changed +7
-11
lines changed Original file line number Diff line number Diff line change @@ -20,8 +20,6 @@ This rule is aimed at maintaining consistency when throwing exception by disallo
20
20
### ❌ Incorrect
21
21
22
22
``` ts
23
- /* eslint @typescript-eslint/no-throw-literal: "error"*/
24
-
25
23
throw ' error' ;
26
24
27
25
throw 0 ;
@@ -53,19 +51,17 @@ throw foo.bar;
53
51
### ✅ Correct
54
52
55
53
``` ts
56
- /* eslint @typescript-eslint/no-throw-literal: "error"*/
57
-
58
54
throw new Error ();
59
55
60
- throw new Error (" error" );
56
+ throw new Error (' error' );
61
57
62
- const e = new Error (" error" );
58
+ const e = new Error (' error' );
63
59
throw e ;
64
60
65
61
try {
66
- throw new Error (" error" );
62
+ throw new Error (' error' );
67
63
} catch (e ) {
68
- throw e ;
64
+ throw e ;
69
65
}
70
66
71
67
const err = new Error ();
@@ -77,13 +73,13 @@ function err() {
77
73
throw err ();
78
74
79
75
const foo = {
80
- bar: new Error ();
81
- }
76
+ bar: new Error (),
77
+ };
82
78
throw foo .bar ;
83
79
84
80
class CustomError extends Error {
85
81
// ...
86
- };
82
+ }
87
83
throw new CustomError ();
88
84
```
89
85
You can’t perform that action at this time.
0 commit comments