-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
[no-floating-promises] Should not report on async IIFEs #647
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
Comments
Using the |
I would be okay with this living as an option. It is potentially a reportable error because you might be using an IIFE to enclose some logic + variables with the intention of awaiting the response. I've seen this pattern before because it saves you passing arguments in, and it avoids the locally scoped variables from leaking into the wider function. Whilst you have intentionally done this pattern, it doesn't mean everyone will intentionally float a promise there. |
You're right. An option would be best. |
While this is true in TSLint (at least for now), it doesn't appear to work in ESLint. Would this be considered a bug, or an enhancement request? Edit: I've just noticed the discussion in #495. |
Repro
Expected Result
I expected it not to report as it's an intentional action. It doesn't catch a mistake.
If you're not willing to add this exception by default, at least add an option to ignore async IIFEs.
Actual Result
It reports as a floating promise, which is technically correct, but not wanted behavior, at least from my perspective.
Additional Info
Versions
@typescript-eslint/eslint-plugin
1.11.0
@typescript-eslint/parser
1.11.0
TypeScript
3.5.1
ESLint
5.16.0
node
8.16.0
npm
6.9.0
The text was updated successfully, but these errors were encountered: