diff --git a/packages/eslint-plugin/docs/rules/no-floating-promises.mdx b/packages/eslint-plugin/docs/rules/no-floating-promises.mdx index 9ef3c839825e..2f8d8040a875 100644 --- a/packages/eslint-plugin/docs/rules/no-floating-promises.mdx +++ b/packages/eslint-plugin/docs/rules/no-floating-promises.mdx @@ -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 @@ -63,6 +64,9 @@ await promise; async function returnsPromise() { return 'value'; } + +void returnsPromise(); + returnsPromise().then( () => {}, () => {}, @@ -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 }`: diff --git a/packages/eslint-plugin/tests/docs-eslint-output-snapshots/no-floating-promises.shot b/packages/eslint-plugin/tests/docs-eslint-output-snapshots/no-floating-promises.shot index 0dc935b52782..5c6de4ab2e0e 100644 --- a/packages/eslint-plugin/tests/docs-eslint-output-snapshots/no-floating-promises.shot +++ b/packages/eslint-plugin/tests/docs-eslint-output-snapshots/no-floating-promises.shot @@ -33,6 +33,9 @@ await promise; async function returnsPromise() { return 'value'; } + +void returnsPromise(); + returnsPromise().then( () => {}, () => {},