Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@emilyinure
Copy link
Contributor

@emilyinure emilyinure commented May 30, 2025

fix: #5277

Summary

Current linting for no-accumulating-spread warns when spread operators are used with accumulators, but not the when directly calling the underlying Object.assign with an accumulator.

#5277 (comment)

Test Plan

Snap tests in specs/performance/noAccumulatingSpread/invalid

	"foo.reduce((acc, bar) => Object.assign(acc, bar), [])",
	"foo.reduceRight((acc, bar) => Object.assign(acc, bar), [])",

	// Array - Body return with Assign
	"foo.reduce((acc, bar) => { return Object.assign(acc, bar) }, [])",
	"foo.reduceRight((acc, bar) => { return Object.assign(acc, bar) }, [])",

and


	// Object - Arrow return with assign
	"foo.reduce((acc, bar) => Object.assign(acc, bar), {})",
	"foo.reduceRight((acc, bar) => Object.assign(acc, bar), {})",

	// Object - Body return with Assign
	"foo.reduce((acc, bar) => { return Object.assign(acc, bar) }, {})",
	"foo.reduceRight((acc, bar) => { return Object.assign(acc, bar) }, {})"

All tests passing

@github-actions github-actions bot added A-Linter Area: linter L-JavaScript Language: JavaScript and super languages labels May 30, 2025
@emilyinure emilyinure changed the title ix: accumulate spread performance linting with object.assign fix: accumulate spread performance linting with object.assign May 30, 2025
@codspeed-hq
Copy link

codspeed-hq bot commented May 30, 2025

CodSpeed Performance Report

Merging #6171 will not alter performance

Comparing emilyinure:fix-accumulating-spread-object-assign (836e956) with main (88a898d)

Summary

✅ 97 untouched benchmarks

@dyc3 dyc3 self-requested a review May 30, 2025 12:08
Copy link
Contributor

@dyc3 dyc3 left a comment

Choose a reason for hiding this comment

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

Couldn't have done it better myself! Just fix my nitpicks. :)

@emilyinure
Copy link
Contributor Author

Thank you! Looking forward to becoming more familiar with the project and contributing more in the future!

@emilyinure emilyinure force-pushed the fix-accumulating-spread-object-assign branch from 99fdb01 to 836e956 Compare May 30, 2025 14:50
@dyc3 dyc3 merged commit 58e78fa into biomejs:main May 30, 2025
2 checks passed
@emilyinure emilyinure deleted the fix-accumulating-spread-object-assign branch May 30, 2025 19:26
@emilyinure emilyinure restored the fix-accumulating-spread-object-assign branch May 30, 2025 19:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-Linter Area: linter L-JavaScript Language: JavaScript and super languages

Projects

None yet

Development

Successfully merging this pull request may close these issues.

💅 Object.assign on Accumulators Shouldn't Be Allowed

2 participants