Skip to content
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

Add no-floating-promises as default rule #110

Closed
yamadayuki opened this issue Jul 1, 2019 · 3 comments · Fixed by #113
Closed

Add no-floating-promises as default rule #110

yamadayuki opened this issue Jul 1, 2019 · 3 comments · Fixed by #113
Labels
enhancement New feature or request

Comments

@yamadayuki
Copy link
Collaborator

WHY & WHAT

We can now use the no-floating-promises
typescript-eslint/typescript-eslint#495

This rule forbids usage of Promise-like values in statements without handling their errors appropriately. Unhandled promises can cause several issues, such as improperly sequenced operations, ignored Promise rejections and more. Valid ways of handling a Promise-valued statement include awaiting, returning, and either calling .then() with two arguments or .catch() with one argument

How do you think about this?
@KentoMoriwaki @chloe463 @kobayang

@yamadayuki yamadayuki added the enhancement New feature or request label Jul 1, 2019
@KentoMoriwaki
Copy link

I want this rule enabled by default.

It is very useful especially when writing tests which including async functions.
For example, this test will pass even when it does not include the text("Some Text") because this sentence returns a unhandled promise.

// Should put `await` head
expect(waitForText("Some Text")).resolves.toBeTruthy();

@kobayang
Copy link
Contributor

kobayang commented Jul 2, 2019

Sounds good to me.

@yamadayuki
Copy link
Collaborator Author

OK, I'll create PR to add the no-floating-promises rule as default.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants