Skip to content

fix: skip Iterator helper chains in jsCombineIterations rule (#205)#212

Open
PranavAgarkar07 wants to merge 1 commit into
millionco:mainfrom
PranavAgarkar07:fix/205-js-combine-iterator-helpers
Open

fix: skip Iterator helper chains in jsCombineIterations rule (#205)#212
PranavAgarkar07 wants to merge 1 commit into
millionco:mainfrom
PranavAgarkar07:fix/205-js-combine-iterator-helpers

Conversation

@PranavAgarkar07
Copy link
Copy Markdown

@PranavAgarkar07 PranavAgarkar07 commented May 12, 2026

Summary

Fixes a false positive in jsCombineIterations where .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 jsCombineIterations reports, reducing false positives; primary risk is missing some real double-iteration warnings in edge cases.

Overview
Updates jsCombineIterations to 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.

@reactreview
Copy link
Copy Markdown

reactreview Bot commented May 12, 2026

Note

No issues found

@vercel
Copy link
Copy Markdown

vercel Bot commented May 12, 2026

@PranavAgarkar07 is attempting to deploy a commit to the Million Team on Vercel.

A member of the Team first needs to authorize it.

Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ 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;
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit ad0f1e6. Configure here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

False positive on Js combine iterations

1 participant