-
-
Notifications
You must be signed in to change notification settings - Fork 538
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
linter: false positive in unicorn/no-useless-spread #4872
Comments
It did come from there, but it was intentional. The thought is that most code written like this doesn't necessarily intending to cast a set into an array, and this instead indicates a bug. Could we suggest that users use |
hmm to me, this feels like quite a common case? a user wants to remove any duplicate elements from the array. maybe |
I'm ok with changing this behavior if such usage is commonplace. Did you run into this because of a linter diagnostic in one of your codebases? Do you have examples of this being done elsewhere? |
yeah we've got it in a bunch of places in our internal codebases. searching GitHub also reveals ~155k results: searching google for "remove duplicate values from array", and this seems to be the main solution (some solutions suggest Ref:
|
👀 guess we're changing this then |
I'm currently moving apartments, but I'll address this when I have time. I have a particular solution in mind. |
does this seem like a reasonable use case for |
This does seem reasonable and used quite frequently, based on the links you sent. I'm ok with removing it straight up. Thoughts? |
sounds good, yeah i think it's gonna be a common use case - we shouldn't report on it |
Please remove this as it is just wrong. :) |
Another thing to point out is pairing this with the |
Closes #4872
the following code proiduces an error on the
...
https://oxc-project.github.io/oxc/playground/?code=3YCAAICogICAgICAgICxG0qZRraXVswdRc9QqqX01RSLQj6CIL60mOY7cTm3PXoTnCmrrStudD9%2FdpNkgA%3D%3D
this is incorrect as
new Set()
returns aSet
where as[...new Set(test || [])]
returns an array.looks like this regressed in #4791 ?
The text was updated successfully, but these errors were encountered: