From a26861bf5cb2d836eb1cec3bd6284cc1c151380d Mon Sep 17 00:00:00 2001 From: Brad Zacher Date: Sun, 19 Apr 2020 22:09:19 -0700 Subject: [PATCH] Update no-floating-promises.md --- .../docs/rules/no-floating-promises.md | 23 +++++-------------- 1 file changed, 6 insertions(+), 17 deletions(-) diff --git a/packages/eslint-plugin/docs/rules/no-floating-promises.md b/packages/eslint-plugin/docs/rules/no-floating-promises.md index b8125ba8fad..d94f2b4cbf4 100644 --- a/packages/eslint-plugin/docs/rules/no-floating-promises.md +++ b/packages/eslint-plugin/docs/rules/no-floating-promises.md @@ -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 }`: @@ -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