Skip to content

Commit

Permalink
docs(eslint-plugin): [no-throw-literal] fix typo in example (#8006)
Browse files Browse the repository at this point in the history
* docs(eslint-plugin): [no-throw-literal] fix typo in example

* chore: format + rm eslint comments
  • Loading branch information
auvred committed Dec 5, 2023
1 parent bff47d7 commit 314f034
Showing 1 changed file with 7 additions and 11 deletions.
18 changes: 7 additions & 11 deletions packages/eslint-plugin/docs/rules/no-throw-literal.md
Expand Up @@ -20,8 +20,6 @@ This rule is aimed at maintaining consistency when throwing exception by disallo
### ❌ Incorrect

```ts
/*eslint @typescript-eslint/no-throw-literal: "error"*/

throw 'error';

throw 0;
Expand Down Expand Up @@ -53,19 +51,17 @@ throw foo.bar;
### ✅ Correct

```ts
/*eslint @typescript-eslint/no-throw-literal: "error"*/

throw new Error();

throw new Error("error");
throw new Error('error');

const e = new Error("error");
const e = new Error('error');
throw e;

try {
throw new Error("error");
throw new Error('error');
} catch (e) {
throw e;
throw e;
}

const err = new Error();
Expand All @@ -77,13 +73,13 @@ function err() {
throw err();

const foo = {
bar: new Error();
}
bar: new Error(),
};
throw foo.bar;

class CustomError extends Error {
// ...
};
}
throw new CustomError();
```

Expand Down

0 comments on commit 314f034

Please sign in to comment.