eslint-community/eslint-plugin-promise
Feature: warn for returned promises that swallow errors
Open
#128 opened on May 21, 2018
enhancementhelp wanted
Repository metrics
- Stars
- (998 stars)
- PR merge metrics
- (PR metrics pending)
Description
Hello,
It would be great if promises in this form triggered a warning:
function foo() {
return bar()
.then(...)
.catch((err) => {
console.error(err);
});
}
Rather than trying to prevent the user from swallowing errors entirely, the goal is to ensure errors are only swallowed intentionally:
function foo() {
return bar()
.then(...)
.catch((err) => { // eslint-disable-line promise/no-swallow-error-in-returned-promise
console.error(err);
});
}
Thanks for considering!