Skip to content

Commit 8fe4272

Browse files
authored
no-array-reduce: Minor refactor (#1825)
1 parent fb613f5 commit 8fe4272

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

rules/no-array-reduce.js

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -78,18 +78,16 @@ const create = context => {
7878

7979
for (const {selector, getMethodNode, isSimpleOperation} of cases) {
8080
listeners[selector] = callExpression => {
81+
if (allowSimpleOperations && isSimpleOperation?.(callExpression)) {
82+
return;
83+
}
84+
8185
const methodNode = getMethodNode(callExpression);
82-
const problem = {
86+
return {
8387
node: methodNode,
8488
messageId: MESSAGE_ID,
8589
data: {method: methodNode.name},
8690
};
87-
88-
if (allowSimpleOperations && isSimpleOperation?.(callExpression)) {
89-
return;
90-
}
91-
92-
return problem;
9391
};
9492
}
9593

0 commit comments

Comments
 (0)