eslint-plugin-promise icon indicating copy to clipboard operation
eslint-plugin-promise copied to clipboard

Feature: warn for returned promises that swallow errors

Open dbkaplun opened this issue 7 years ago • 0 comments
trafficstars

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!

dbkaplun avatar May 21 '18 15:05 dbkaplun