Skip to content

Commit 8980e28

Browse files
committed
perf: finish early
1 parent e193f68 commit 8980e28

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

rules/always-return.js

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -283,19 +283,13 @@ module.exports = {
283283
}
284284

285285
if (ignoreAssignmentVariable.length && isLastCallback(node)) {
286-
let hasIgnoredAssignment = false
287-
288-
//istanbul ignore else
286+
// istanbul ignore else
289287
if (node.body?.type === 'BlockStatement') {
290-
node.body.body.forEach((statement) => {
288+
for (const statement of node.body.body) {
291289
if (isIgnoredAssignment(statement, ignoreAssignmentVariable)) {
292-
hasIgnoredAssignment = true
290+
return
293291
}
294-
})
295-
}
296-
297-
if (hasIgnoredAssignment) {
298-
return
292+
}
299293
}
300294
}
301295

0 commit comments

Comments
 (0)