promise/prefer-catch
eslint-plugin-promise
Safe autofix
eslint.config.js
import promise from "eslint-plugin-promise";
export default [
{
plugins: { promise },
rules: {
"promise/prefer-catch": "error",
},
},
];prom.then(fn1).then(fn2)
prom.catch(handleErr).then(handle)hey.then(fn1, fn2)
hey.then(null, fn2)The documentation shows no correct example for this rule.
Examples from the ESLint documentation.
promise/prefer-catch
eslint-plugin-promise
import promise from "eslint-plugin-promise";
export default [
{
plugins: { promise },
rules: {
"promise/prefer-catch": "error",
},
},
];promise/prefer-catch
promise plugin · style
{
"plugins": [
"promise"
],
"rules": {
"promise/prefer-catch": "error"
}
}Biome does not have this rule.
Disallow creating new promises with paths that resolve multiple times.
Disallow creating new promises outside of utility libs (use [util.promisify][] instead).
Prefer async/await to the callback pattern.
Disallow use of non-standard Promise static methods.
Prefer await to then()/catch()/finally() for reading Promise values.
Enforces the proper number of arguments are passed to Promise functions.