You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I believe an unhandled Promise.resolve() is valid, but opening up a Node 8 REPL shows the following:
❯ node
> const FAIL = Promise.reject()
undefined
> (node:99089) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): undefined
(node:99089) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
I think warning for usages of Promise.reject() that aren't returned in a function would be a good addition. For example, assigning Promise.reject() to a variable in your example would be invalid.
I'm not 100% sure if it belongs in the promise/catch-or-return rule or if it should be part of another rule. I think that is worth discussing a little bit.
Discussion and PRs are welcome (even to discuss an initial implementation - we can always move it into another rule at the PR stage).
This innocently looking assignment:
causes UnhandledPromiseRejectionWarning if FAIL is not used...
The text was updated successfully, but these errors were encountered: