enforce call specified function or rethrow inside catch clause.
.eslintrc.js
module.exports = {
plugins: ['eslint-plugin-catch-call-function'],
rules:{
// must call reportError function or re throw
'catch-call-function/catch-call-function':['error', ['reportError','throw']],
}
};
correct:
/*eslint catch-call-function/catch-call-function: ["error", ["reportError","throw"]]*/
try {
console.log(1);
} catch (e) {
reportError(e);
// throw e;
}
wrong:
/*eslint catch-call-function/catch-call-function: ["error", ["reportError"]]*/
try {
console.log(1);
} catch (e) {
console.log(e);
}
3:3 error Must call function inside catch: reportError catch-call-function/catch-call-function