fix: skip Iterator helper chains in jsCombineIterations rule (#205)#212
fix: skip Iterator helper chains in jsCombineIterations rule (#205)#212PranavAgarkar07 wants to merge 1 commit into
Conversation
|
Note No issues found |
|
@PranavAgarkar07 is attempting to deploy a commit to the Million Team on Vercel. A member of the Team first needs to authorize it. |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit ad0f1e6. Configure here.
| innerReceiver.callee.property.name === "keys") | ||
| ) { | ||
| return; | ||
| } |
There was a problem hiding this comment.
Check incorrectly skips Object.values/entries/keys array chains
Medium Severity
The new guard matches any call to a method named values, entries, or keys, including static calls like Object.values(obj), Object.entries(obj), and Object.keys(obj). These Object static methods return plain arrays, not lazy iterators, so chaining .filter().map() on them does create intermediate array allocations. The rule now silently skips Object.values(data).filter(fn).map(fn) — a very common real-world pattern — producing a false negative. The check needs to exclude cases where the receiver of .values()/.entries()/.keys() is Object.
Reviewed by Cursor Bugbot for commit ad0f1e6. Configure here.


Summary
Fixes a false positive in
jsCombineIterationswhere.values().filter().map()and similar Iterator helper chains were flagged as inefficient double iterations.Iterator helpers (
.values(),.entries(),.keys()) produce lazy iterators, not intermediate arrays — chaining.filter()and.map()on them does NOT create multiple array allocations. This PR adds a check that skips the rule when the inner call's receiver is an iterator-producing method call.Closes #205
Note
Low Risk
Low risk rule tweak that only narrows when
jsCombineIterationsreports, reducing false positives; primary risk is missing some real double-iteration warnings in edge cases.Overview
Updates
jsCombineIterationsto skip reporting when the inner chained call’s receiver is an iterator-producing helper (.values(),.entries(),.keys()), preventing false positives for lazy iterator chains like.values().filter().map().Reviewed by Cursor Bugbot for commit ad0f1e6. Bugbot is set up for automated code reviews on this repo. Configure here.