Disallow for-of
See original GitHub issueThe style guide 11.1 says that you shouldn’t use for-of
and instead should use forEach
(which I completely agree with).
That said, the ESLint rule no-iterator
doesn’t seem to enforce this, and the entry for no-restricted-syntax
contains ForInStatement
but not ForOfStatement
.
Can we add ForOfStatement
to no-restricted-syntax
(or is the a better way of restricting for-of
statements?
Issue Analytics
- State:
- Created 7 years ago
- Reactions:1
- Comments:122 (8 by maintainers)
Top Results From Across the Web
17. The for-of loop - Exploring JS
for-of is a new loop in ES6 that replaces both for-in and forEach() and supports the new iteration protocol. Use it to loop...
Read more >Remove array item using for...of loop - Stack Overflow
I'm trying to edit an array and remove elements that do not meet a certain condition. If I use ...
Read more >disallow for-of statements (es/no-for-of-loops) | eslint ... - mysticatea
ESLint plugin about ECMAScript syntax.
Read more >How to use the for…of Statement in JavaScript - Tabnine
The for…of statement is a very powerful for three reasons: It can loop through any iterable object – these include Strings, Arrays, array-like- ......
Read more >JavaScript For Of - W3Schools
The JavaScript for of statement loops through the values of an iterable ... code block to be executed ... For/of was added to...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@dplusic in nice, simple ES6:
@dplusic @ljharb I don’t understand. Where’s the advantage in making your code totally unreadable? Purity is nice, but not when it takes 30 minutes to decipher a simple function.