-
-
Notifications
You must be signed in to change notification settings - Fork 381
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
no-new-array
confusing error message leading to new-for-builtins
#2442
Comments
eslint-plugin-unicorn/rules/no-new-array.js Lines 72 to 81 in 891842d
It should be fixed to Array.from({ length: repeat }) 2024-09-02.13.48.18.mov |
no-new-array
autofix triggers new-for-builtins
no-new-array
autofix triggers new-for-builtins
no-new-array
direct opposite of new-for-builtins
Judging from the description of
This is purely a documentation issue, the error should not be:
But something like:
|
no-new-array
direct opposite of new-for-builtins
no-new-array
confusing error message leading to new-for-builtins
The eslint-plugin-unicorn has conflicting rules when trying to create a new array in JSX. Specifically, the rules unicorn/no-new-array and unicorn/new-for-builtins give contradictory advice, making it impossible to create a new array without an ESLint error.
When using new Array(repeat), I get an error from eslint/unicorn/no-new-array. If I remove the new keyword and just use Array(repeat), then I get an error from eslint/unicorn/new-for-builtins. This creates a confusing situation where neither approach is valid according to the current rules.
The rules unicorn/no-new-array and unicorn/new-for-builtins appear to be in conflict with each other.
Expected Behavior
There should be a clear, non-conflicting recommendation for creating arrays in this context.
Environment
The text was updated successfully, but these errors were encountered: