diff --git a/src/rules/guard-super-call.ts b/src/rules/guard-super-call.ts index e520b84..b749636 100644 --- a/src/rules/guard-super-call.ts +++ b/src/rules/guard-super-call.ts @@ -107,24 +107,13 @@ const rule: Rule.RuleModule = { return isUnguardedSuperHook(node.consequent, hook); } else if ( node.type === 'BlockStatement' && - node.body.some(checkNodeForUnguardedSuperHook(hook)) + node.body.some((n) => isUnguardedSuperHook(n, hook)) ) { return true; } return false; } - /** - * Allows for currying the hook to the isUnguardedSuperHook call - * @param {string} hook hook to test - * @return {function} - */ - function checkNodeForUnguardedSuperHook( - hook: string - ): (n: ESTree.Node) => boolean { - return (node: ESTree.Node) => isUnguardedSuperHook(node, hook); - } - //---------------------------------------------------------------------- // Public //---------------------------------------------------------------------- @@ -153,10 +142,7 @@ const rule: Rule.RuleModule = { if ( node.key.type === 'Identifier' && node.value.type === 'FunctionExpression' && - node.value.body.type === 'BlockStatement' && - node.value.body.body.some( - checkNodeForUnguardedSuperHook(node.key.name) - ) + isUnguardedSuperHook(node.value.body, node.key.name) ) { context.report({ node: errNode,