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 prefer spread over .slice()/.concat()
#737
Comments
Maybe, if the user is using the TypeScript parser (#347), we could handle it? And if not, just use suggestions. |
prefer-spread
: Add prefer spread over .slice()/.concat()
prefer-array-spread
: Add prefer spread over .slice()/.concat()
|
@sindresorhus I mean add to our existing rule |
prefer-array-spread
: Add prefer spread over .slice()/.concat()
prefer-spread
: Add prefer spread over .slice()/.concat()
I feel bad that I can't distinguish Let's close this? |
@fisker Maybe we can make it opt-in? I have personally never used or seen |
Are you open to an option to ignore |
@coreyfarrell You can just use |
That is a reasonable replacement, thanks! |
Currently,
prefer-spread
only checkArray.from()
, how about add prefer spread over.slice()/.concat()
?Fail
Pass
The
concat()
case, we can't knowitem
is array or not.Maybe with suggestions?
Suggestion 1:
[...array, itemOrArray]
Suggestion 2:
[...array, ...itemOrArray]
Another problem is
TypedArray#slice()
andString#concat()
.String#slice
should not a problem. Nobody usestring.slice()
(no arguments).Any other method people use to clone an array?
The text was updated successfully, but these errors were encountered: