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

prefer-spread: Add more suggestions for .concat fix #1054

Merged
merged 7 commits into from Jan 25, 2021

Conversation

fisker
Copy link
Collaborator

@fisker fisker commented Jan 23, 2021

If first argument has no sideEffect, added a new suggestion to test it with Array.isArray()

- [1].concat(foo, 2);
+ [1, ...(Array.isArray(foo) : foo : [foo]), 2]

If there are more unknown arguments, added a new suggestion to spread all unknown arguments

- [1].concat(foo, bar);
+ [1, ...foo, ...bar];

Base automatically changed from master to main January 23, 2021 11:04
@fisker fisker changed the title prefer-spread: Add a useful suggestion for .concat fix prefer-spread: Add suggestions for .concat fix Jan 25, 2021
@fisker fisker marked this pull request as draft January 25, 2021 01:50
@fisker fisker marked this pull request as ready for review January 25, 2021 02:30
@fisker fisker changed the title prefer-spread: Add suggestions for .concat fix prefer-spread: Add more suggestions for .concat fix Jan 25, 2021
@sindresorhus sindresorhus merged commit 673c440 into sindresorhus:main Jan 25, 2021
@fisker fisker deleted the prefer-spread-suggest branch January 25, 2021 23:58
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.

None yet

2 participants