Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork2.8k
Description
Before You File a Documentation Request Please Confirm You Have Done The Following...
- I have looked for existingopen or closed documentation requests that match my proposal.
- I haveread the FAQ and my problem is not listed.
Suggested Changes
Right now,@typescript-eslint/no-floating-promises
logs quite a mouthful for its messages:
Promises must be awaited, end with a call to .catch, end with a call to .then with a rejection handler or be explicitly marked as ignored with the `void` operator.
So much text! Longer messages are less likely to be read by users - especially "error" (or "warning") messages like this one.
In addition, it's also missing the point that storing the Promise in a variable is considered an acceptable workaround by the rule (assuming you have unused variable detection enabled).#8046 is an example of a discussion asking about that.
This is a nuanced area. See replies to:https://twitter.com/flybayer/status/1469098848958222337,https://twitter.com/threepointone/status/1471458830626299911,https://twitter.com/nandafyi/status/1736164705448956388, and other threads from searching onno-floating-promises
). I think we should rework the rule a bit to coach/encourage developers into treating the nuance with care:
- Make the error message much shorter (so folks will actually read the whole thing), and perhaps encourage them to read the docs for more info
- Mention the unused variable allowance in the docs
- Link to a blog post explaining how to enable our Promise/Thenable-area rules (perhaps a separate issue?)