From 016ea35ac18160bf23755c6a4dc0db7ce4bf78f8 Mon Sep 17 00:00:00 2001 From: Tony Date: Tue, 30 Sep 2025 11:06:17 +0800 Subject: [PATCH] chore(eslint): ensure proper error handling --- eslint.config.mjs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/eslint.config.mjs b/eslint.config.mjs index e331ab938..9bd3082a4 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -110,16 +110,20 @@ export default [ message: 'Please use .toArray() before .map().', }, { - selector: 'CallExpression[callee.property.name="catch"] > ArrowFunctionExpression[params.length<=1][body.value=null]', + selector: 'CallExpression[callee.property.name="catch"] > ArrowFunctionExpression[params.length=0][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.type="Identifier"][body.name="undefined"]', + selector: 'CallExpression[callee.property.name="catch"] > ArrowFunctionExpression[params.length=0][body.type="Identifier"][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." + selector: 'CallExpression[callee.property.name="catch"] > ArrowFunctionExpression[params.length=0] > ArrayExpression[elements.length=0]', + message: "Usage of .catch(() => []) is not allowed. Please handle the error appropriately." + }, + { + selector: 'CallExpression[callee.property.name="catch"] > ArrowFunctionExpression[params.length=0] > BlockStatement[body.length=0]', + message: "Usage of .catch(() => {}) is not allowed. Please handle the error appropriately." } ],