-
-
Notifications
You must be signed in to change notification settings - Fork 929
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
infra(unicorn): no-array-for-each #2461
Conversation
I'm not sure about this one. |
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## next #2461 +/- ##
==========================================
- Coverage 99.58% 99.58% -0.01%
==========================================
Files 2823 2823
Lines 255529 255518 -11
Branches 1106 1104 -2
==========================================
- Hits 254478 254464 -14
- Misses 1023 1026 +3
Partials 28 28
|
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.
Personally, I prefer for..of
loops over Array.prototype.forEach
. It make the code more consistent as you can use for..of
for all iterables and not only arrays. Additionally, I've read some time ago that they were supposed to be more performant, but according to this StackOverflow comment this is no longer the case. Last argument I can bring for the for..of
loop is that you dont leave the this
scope. This resolves potential issues with hoisting or this
-binding.
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.
Personally, I prefer for..of
loops over Array.prototype.forEach
. It make the code more consistent as you can use for..of
for all iterables and not only arrays. Additionally, I've read some time ago that they were supposed to be more performant, but according to this StackOverflow comment this is no longer the case. Last argument I can bring for the for..of
loop is that you dont leave the this
scope. This resolves potential issues with hoisting or this
-binding.
Ref: #2439
Enables the
unicorn/no-array-for-each
lint rule.