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

Modify rule S6544: (no-misused-promises fix FP) improve message for conditionals #3625

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions rules/S6544/javascript/rule.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,17 @@ If you mistakenly treated a promise as its resolved value, you can ensure it is
})();
----

If you want to check that a promise is defined, you can explicitly compare it to `undefined`:

[source,javascript]
----
const promise = flag ? Promise.resolve(true) : undefined;

if (promise === undefined) {
// ...
}
----

//== How to fix it in FRAMEWORK NAME

=== Code examples
Expand Down