Thanks to visit codestin.com
Credit goes to github.com

Skip to content

docs(eslint-plugin): [no-floating-promises] make void a more prominent suggestion #9117

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion packages/eslint-plugin/docs/rules/no-floating-promises.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ Valid ways of handling a Promise-valued statement include:

- `await`ing it
- `return`ing it
- `void`ing it
- Calling its `.then()` with two arguments
- Calling its `.catch()` with one argument

Expand Down Expand Up @@ -63,6 +64,9 @@ await promise;
async function returnsPromise() {
return 'value';
}

void returnsPromise();

returnsPromise().then(
() => {},
() => {},
Expand All @@ -82,7 +86,7 @@ await Promise.all([1, 2, 3].map(async x => x + 1));

### `ignoreVoid`

This allows you to stop the rule reporting promises consumed with void operator.
This option, which is `true` by default, allows you to stop the rule reporting promises consumed with void operator.
This can be a good way to explicitly mark a promise as intentionally not awaited.

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

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading