Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

eslint-plugin-no-for-of-loops

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint-plugin-no-for-of-loops

Prevents for..of loops usage

  • 1.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
28K
increased by17.82%
Maintainers
1
Weekly downloads
 
Created
Source

eslint-plugin-no-for-of-loops

An eslint plugin to prevent for (...of) loops usage in your code base.

Build Status npm Greenkeeper badge

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 Symbol and iterator polyfills 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 a few kilobytes.

See for..of and Symbol compatibily tables for more details.

Disabling the rule

Want to disable the rule anyway? Your call :

// eslint-disable-next-line no-for-of-loops/no-for-of-loops
for (let i of iterable) {
  // ...
}

Credits

This project was initialy forked form eslint-plugin-no-loops. Kudos!

Keywords

FAQs

Package last updated on 26 Jul 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc