catch-or-return
Configuration
Enforce the use of catch() on un-returned promises.
Rule Details
A promise that is used as a statement — rather than returned from a function — must
be terminated with a rejection handler. Without one, rejected promises produce
unhandled-rejection errors that are easy to miss. This rule enforces that every
such promise chain ends with .catch() (or a configured alternative), so the
caller cannot silently swallow errors.
Examples of incorrect code for this rule:
Examples of correct code for this rule:
Options
allowThen
Pass { "allowThen": true } to accept a two-argument .then(onFulfilled, onRejected) call as
a valid termination in place of .catch().
allowThenStrict
Like allowThen, but the first argument to .then() must be null so the handler is
exclusively for rejections.
allowFinally
Pass { "allowFinally": true } to allow a .finally() call after a valid termination.
terminationMethod
Replace catch with an alternative method name, or provide an array of accepted names.
Differences from ESLint
None known.