Skip to content

Commit 9414dcf

Browse files
feat(no-throw-statements)!: replace option allowInAsyncFunctions with allowToRejectPromises
1 parent 23b1c44 commit 9414dcf

File tree

11 files changed

+288
-152
lines changed

11 files changed

+288
-152
lines changed

docs/rules/no-throw-statements.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,15 +54,15 @@ This rule accepts an options object of the following type:
5454

5555
```ts
5656
type Options = {
57-
allowInAsyncFunctions: boolean;
57+
allowToRejectPromises: boolean;
5858
};
5959
```
6060

6161
### Default Options
6262

6363
```ts
6464
const defaults = {
65-
allowInAsyncFunctions: false,
65+
allowToRejectPromises: false,
6666
};
6767
```
6868

@@ -72,19 +72,19 @@ const defaults = {
7272

7373
```ts
7474
const recommendedAndLiteOptions = {
75-
allowInAsyncFunctions: true,
75+
allowToRejectPromises: true,
7676
};
7777
```
7878

79-
### `allowInAsyncFunctions`
79+
### `allowToRejectPromises`
8080

81-
If true, throw statements will be allowed within async functions.\
81+
If true, throw statements will be allowed when they are used to reject a promise, such when in an async function.\
8282
This essentially allows throw statements to be used as return statements for errors.
8383

8484
#### ✅ Correct
8585

8686
```js
87-
/* eslint functional/no-throw-statements: ["error", { "allowInAsyncFunctions": true }] */
87+
/* eslint functional/no-throw-statements: ["error", { "allowToRejectPromises": true }] */
8888

8989
async function divide(x, y) {
9090
const [xv, yv] = await Promise.all([x, y]);

0 commit comments

Comments
 (0)