mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-18 02:21:13 +00:00
refactor: Add lint rule no-unused-param-in-catch-clause (#5868)
👕 Add lint rule `no-unused-param-in-catch-clause`
This commit is contained in:
@@ -140,6 +140,36 @@ module.exports = {
|
||||
},
|
||||
},
|
||||
|
||||
'no-unused-param-in-catch-clause': {
|
||||
meta: {
|
||||
type: 'problem',
|
||||
docs: {
|
||||
description: 'Unused param in catch clause must be omitted.',
|
||||
recommended: 'error',
|
||||
},
|
||||
messages: {
|
||||
removeUnusedParam: 'Remove unused param in catch clause',
|
||||
},
|
||||
fixable: 'code',
|
||||
},
|
||||
create(context) {
|
||||
return {
|
||||
CatchClause(node) {
|
||||
if (node.param?.name.startsWith('_')) {
|
||||
const start = node.range[0] + 'catch '.length;
|
||||
const end = node.param.range[1] + '()'.length;
|
||||
|
||||
context.report({
|
||||
messageId: 'removeUnusedParam',
|
||||
node,
|
||||
fix: (fixer) => fixer.removeRange([start, end]),
|
||||
});
|
||||
}
|
||||
},
|
||||
};
|
||||
},
|
||||
},
|
||||
|
||||
'no-interpolation-in-regular-string': {
|
||||
meta: {
|
||||
type: 'problem',
|
||||
|
||||
Reference in New Issue
Block a user