hapi-for-you

hapi style guide ESLint rule dealing with for loops

This module has moved and is now available at @hapi/rule-for-loop. Please update your dependencies as this version is no longer maintained an may contain bugs and security issues.
Last updated 9 years ago by cjihrig .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ npm install hapi-for-you 
SYNC missed versions from official npm registry.

hapi-for-you

Current Version Build Status via Travis CI Dependencies

hapi style guide ESLint rule dealing with for loops. This rule enforces the following:

  • Restrict iterator variable names. for loop iterator variables should be named i. Nested loops should use the variables j, k, and so on.
  • Restrict loop nesting. You can restrict the maximum nesting of for loops. By default, this limit is three.
  • Prevent postfix increment and decrement operators. The hapi style guide does not allow postfix increment and decrement operators in for loop updates. The prefix version of these operators should be used instead.
  • Single variable declaration in initialization section. A single var i = 0; is allowed in the initialization section. This only applies to variable declarations, not assignments to existing variables. This means that for (i = 0, j = 0) is allowed if i and j are existing variables. Variable declarations involving destructuring are not allowed.

Rule options

This rule can be configured by providing a single options object. The object supports the following keys.

maxDepth

A number representing the maximum allowed nesting of for loops. Defaults to three.

startIterator

The first variable iterator name to use. This defaults to 'i'.

Current Tags

  • 1.0.0                                ...           latest (9 years ago)

1 Versions

  • 1.0.0 [deprecated]           ...           9 years ago
Maintainers (1)
Downloads
Total 0
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (0)
None
Dev Dependencies (4)
Dependents (1)

© 2010 - cnpmjs.org x YWFE | Home | YWFE