Skip to content
This repository has been archived by the owner on Mar 25, 2021. It is now read-only.

Disallow boolean test on promise #4152

Closed
burtonator opened this issue Sep 4, 2018 · 1 comment
Closed

Disallow boolean test on promise #4152

burtonator opened this issue Sep 4, 2018 · 1 comment

Comments

@burtonator
Copy link

Rule Suggestion

Is your rule for a general problem or is it specific to your development style?

General problem.

What does your suggested rule do?

Prevents an always positive boolean test.

List several examples where your rule could be used

if you have a Promise disallow an if test against it.

It will ALWAYS return true and is almost certainly not what you want. You almost certainly want to await it first.

This just bit me hard and I spent 2-3 hours trying to track this down before I realized my mistake.

@JoshuaKGoldberg
Copy link
Contributor

Duplicate of #3983; should be better documented per #4117.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants