chore(eslint): ensure proper error handling

This commit is contained in:
Tony 2025-09-30 01:12:04 +08:00
parent fb7e42cef3
commit 3a8465a422
1 changed files with 8 additions and 0 deletions

View File

@ -113,6 +113,14 @@ export default [
selector: 'CallExpression[callee.property.name="catch"] > ArrowFunctionExpression[params.length<=1][body.value=null]',
message: 'Usage of .catch(() => null) is not allowed. Please handle the error appropriately.',
},
{
selector: 'CallExpression[callee.property.name="catch"] > ArrowFunctionExpression[params.length<=1][body.name=undefined]',
message: 'Usage of .catch(() => undefined) is not allowed. Please handle the error appropriately.',
},
{
selector: 'CallExpression[callee.property.name="catch"] > ArrowFunctionExpression[params.length<=1] > ArrayExpression[elements.length<=1]',
message: "Usage of .catch(() => []]) is not allowed. Please handle the error appropriately."
}
],
'no-unneeded-ternary': 'error',