Skip to content

Commit

Permalink
no-array-reduce: Minor refactor (#1825)
Browse files Browse the repository at this point in the history
  • Loading branch information
fisker committed May 26, 2022
1 parent fb613f5 commit 8fe4272
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions rules/no-array-reduce.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,18 +78,16 @@ const create = context => {

for (const {selector, getMethodNode, isSimpleOperation} of cases) {
listeners[selector] = callExpression => {
if (allowSimpleOperations && isSimpleOperation?.(callExpression)) {
return;
}

const methodNode = getMethodNode(callExpression);
const problem = {
return {
node: methodNode,
messageId: MESSAGE_ID,
data: {method: methodNode.name},
};

if (allowSimpleOperations && isSimpleOperation?.(callExpression)) {
return;
}

return problem;
};
}

Expand Down

0 comments on commit 8fe4272

Please sign in to comment.