Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(linter): remove unsafe fixer of no-useless-spread #6655

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

shulaoda
Copy link
Contributor

closes #6618

Copy link

graphite-app bot commented Oct 18, 2024

Your org has enabled the Graphite merge queue for merging into main

Add the label “0-merge” to the PR and Graphite will automatically add it to the merge queue when it’s ready to merge. Or use the label “hotfix” to add to the merge queue as a hot fix.

You must have a Graphite account and log in to Graphite in order to use the merge queue. Sign up using this link.

@github-actions github-actions bot added A-linter Area - Linter C-bug Category - Bug labels Oct 18, 2024
Comment on lines 640 to 646
⚠ eslint-plugin-unicorn(no-useless-spread): Using a spread operator here creates a new array unnecessarily.
╭─[no_useless_spread.tsx:1:2]
1 │ [...new Array(3)]
· ───
╰────
help: `new Array(3)` returns a new array. Spreading it into an array expression to create a new array is redundant.

Copy link
Collaborator

@camc314 camc314 Oct 18, 2024

Choose a reason for hiding this comment

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

i think we should still report this case - unicorn/no-useless-spread reports an error.
how about we just don't suggest a fix in this case

to add, i'm happy for this to be discussed 🙂

Copy link
Contributor Author

@shulaoda shulaoda Oct 19, 2024

Choose a reason for hiding this comment

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

I'm wondering if we should fix [...new Array(3)] to new Array(3).fill(), or just give a warning. @DonIsaac cc

Copy link

codspeed-hq bot commented Oct 18, 2024

CodSpeed Performance Report

Merging #6655 will not alter performance

Comparing shulaoda:fix/linter-no-useless-spread (9871a55) with main (1a90ec4)

Summary

✅ 30 untouched benchmarks

@shulaoda shulaoda marked this pull request as draft October 18, 2024 09:47
@DonIsaac
Copy link
Collaborator

In this case, we should mark the fix as dangerous instead of skipping it entirely

@shulaoda shulaoda marked this pull request as ready for review October 19, 2024 14:58
@shulaoda shulaoda requested a review from camc314 October 19, 2024 15:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-linter Area - Linter C-bug Category - Bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

linter: unsafe fixer in no-useless-spread
3 participants