eslint-plugin-no-for-of-loops
Prevents for (...of)
loops usage in your code base.
Installation
npm install --save-dev eslint-plugin-no-for-of-loops
Usage
In your .eslintrc
:
{
"plugins": [
"no-for-of-loops"
],
"rules": {
"no-for-of-loops/no-for-of-loops": 2
}
}
Rule
Disallow use of for (..of)
loops.
Why
Using for (...of)
loops requires a Symbol
and iterator polyfill to work on older browsers (see babel/babel#1534)
Depending on your browsers target (for example, Android 4.4 in-app Webview is capped to Chrome 33), you might not want to include those polyfills to save some kilobytes.
See for..of and Symbol compatibily tables
Disabling the rule
What to disable the rule anyway? Your call :
for (let i of iterable) {
}
Credits
This project was initialy forked form eslint-plugin-no-loops. Kudos!