Skip to content

Commit

Permalink
Update no-floating-promises.md
Browse files Browse the repository at this point in the history
  • Loading branch information
bradzacher committed Apr 20, 2020
1 parent a26861b commit 6548b1c
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions packages/eslint-plugin/docs/rules/no-floating-promises.md
Expand Up @@ -11,36 +11,36 @@ either calling `.then()` with two arguments or `.catch()` with one argument.
Examples of **incorrect** code for this rule:

```ts
const promise = new Promise((resolve, reject) => resolve('value'));
const promise = new Promise((resolve, reject) => resolve("value"));
promise;

async function returnsPromise() {
return 'value';
return "value";
}
returnsPromise().then(() => {});

Promise.reject('value').catch();
Promise.reject("value").catch();

Promise.reject('value').finally();
Promise.reject("value").finally();
```

Examples of **correct** code for this rule:

```ts
const promise = new Promise((resolve, reject) => resolve('value'));
const promise = new Promise((resolve, reject) => resolve("value"));
await promise;

async function returnsPromise() {
return 'value';
return "value";
}
returnsPromise().then(
() => {},
() => {},
() => {}
);

Promise.reject('value').catch(() => {});
Promise.reject("value").catch(() => {});

Promise.reject('value').finally(() => {});
Promise.reject("value").finally(() => {});
```

## Options
Expand Down Expand Up @@ -69,11 +69,11 @@ Examples of **correct** code for this rule with `{ ignoreVoid: true }`:

```ts
async function returnsPromise() {
return 'value';
return "value";
}
void returnsPromise();

void Promise.reject('value');
void Promise.reject("value");
```

### `ignoreIIFE`
Expand All @@ -83,11 +83,11 @@ This allows you to skip checking of async iife
Examples of **correct** code for this rule with `{ ignoreIIFE: true }`:

```ts
await (async function() {
await(async function () {
await res(1);
})();

(async function() {
(async function () {
await res(1);
})();
```
Expand Down

0 comments on commit 6548b1c

Please sign in to comment.