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 836a7e8 commit a26861b
Showing 1 changed file with 6 additions and 17 deletions.
23 changes: 6 additions & 17 deletions packages/eslint-plugin/docs/rules/no-floating-promises.md
Expand Up @@ -62,7 +62,8 @@ const defaults = {

### `ignoreVoid`

This allows to easily suppress false-positives with void operator.
This allows you to stop the rule reporting promises consumed with void operator.
This can be a good way to explicitly mark a promise as intentially not awaited.

Examples of **correct** code for this rule with `{ ignoreVoid: true }`:

Expand All @@ -77,35 +78,23 @@ void Promise.reject('value');

### `ignoreIIFE`

This allows to skip checking of async iife
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);
})();

const foo = () =>
new Promise(res => {
(async function() {
await res(1);
})();
});
```

Examples of **incorrect** code for this rule with `{ ignoreIIFE: true }`:

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

## When Not To Use It

If you do not use Promise-like values in your codebase or want to allow them to
remain unhandled.
If you do not use Promise-like values in your codebase, or want to allow them to remain unhandled.

## Related to

Expand Down

0 comments on commit a26861b

Please sign in to comment.