Skip to content

[no-floating-promises] Should not report on async IIFEs #647

Closed
@sindresorhus

Description

@sindresorhus

Repro

{
  "rules": {
    "@typescript-eslint/no-floating-promises": "error"
  }
}
(async () => {
	await something();
})();

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

package version
@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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions