Skip to content

💅 Object.assign on Accumulators Shouldn't Be Allowed #5277

Open
@mssngr

Description

@mssngr

Environment information

I am using Biome strictly in the IDE, so this n/a for me.

Rule name

no-accumulating-spread

Playground link

https://biomejs.dev/playground/?code=YwBvAG4AcwB0ACAAYQByAHIAYQB5AE8AZgBPAGIAagBzACAAPQAgAFsAewAKACAAIABoAGUAbABsAG8AOgAgACcAdwBvAHIAbABkACEAJwAKAH0AXQAKAAoAYQByAHIAYQB5AE8AZgBPAGIAagBzAC4AcgBlAGQAdQBjAGUAKAAoAGEAYwBjAHUAbQAsACAAbwBiAGoAKQAgAD0APgAgAE8AYgBqAGUAYwB0AC4AYQBzAHMAaQBnAG4AKABhAGMAYwB1AG0ALAAgAG8AYgBqACkALAAgAHsAfQApAA%3D%3D

Expected result

The No Accumulating Spread rule prevents the O(n^2) problem by not allowing the use of object spreader syntax on accumulators. However, object spreader syntax is just syntactical sugar for Object.assign. And no error is shown for utilizing Object.assign on an accumulator, even though it faces the same O(n^2) problem.

Code of Conduct

  • I agree to follow Biome's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-LinterArea: linterL-JavaScriptLanguage: JavaScript and super languagesS-Bug-confirmedStatus: report has been confirmed as a valid buggood first issueGood for newcomers

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions