Skip to content

Commit 314f034

Browse files
authored
docs(eslint-plugin): [no-throw-literal] fix typo in example (typescript-eslint#8006)
* docs(eslint-plugin): [no-throw-literal] fix typo in example * chore: format + rm eslint comments
1 parent bff47d7 commit 314f034

File tree

1 file changed

+7
-11
lines changed

1 file changed

+7
-11
lines changed

packages/eslint-plugin/docs/rules/no-throw-literal.md

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@ This rule is aimed at maintaining consistency when throwing exception by disallo
2020
### ❌ Incorrect
2121

2222
```ts
23-
/*eslint @typescript-eslint/no-throw-literal: "error"*/
24-
2523
throw 'error';
2624

2725
throw 0;
@@ -53,19 +51,17 @@ throw foo.bar;
5351
### ✅ Correct
5452

5553
```ts
56-
/*eslint @typescript-eslint/no-throw-literal: "error"*/
57-
5854
throw new Error();
5955

60-
throw new Error("error");
56+
throw new Error('error');
6157

62-
const e = new Error("error");
58+
const e = new Error('error');
6359
throw e;
6460

6561
try {
66-
throw new Error("error");
62+
throw new Error('error');
6763
} catch (e) {
68-
throw e;
64+
throw e;
6965
}
7066

7167
const err = new Error();
@@ -77,13 +73,13 @@ function err() {
7773
throw err();
7874

7975
const foo = {
80-
bar: new Error();
81-
}
76+
bar: new Error(),
77+
};
8278
throw foo.bar;
8379

8480
class CustomError extends Error {
8581
// ...
86-
};
82+
}
8783
throw new CustomError();
8884
```
8985

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy