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
: Fix more .concat
cases
#1042
Conversation
@@ -531,7 +531,7 @@ Generated by [AVA](https://avajs.dev). | |||
> Output | |||
|
|||
`␊ | |||
1 | [1, 2]␊ | |||
1 | [1, 2,]␊ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this be:
1 | [1, 2,]␊ | |
1 | [1, , 2]␊ |
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No,
> [1,].concat(2)
[ 1, 2 ]
> [1, , 2]
[ 1, <1 empty item>, 2 ]
It fixed in this way, because 2
inserted after 1
, and the old [1,]
has trailing comma, we keep it, so [1, 2,]
is correct.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok. I misunderstood how concat works with holes. I assumed [1,]
would create 1
+ a hole, but you need [1,,]
to get a hole.
.concat()
call..concat(...)
..concat(...)
with rest arguments..concat(...a)
no auto-fix, no suggestions, as we don't know whata
is.Fixes #1041