Skip to content

Latest commit

 

History

History
28 lines (20 loc) · 487 Bytes

no-c-like-loops.md

File metadata and controls

28 lines (20 loc) · 487 Bytes

Prohibits the usage of c-like loop when you iterate over array and have i++ or i +=1

Error only on case when you iterate over array and have i++ or i +=1

Rule Details

Error only on case when you iterate over array and have i++ or i +=1;

// Example of incrorrect code

for (var i = 0; i < list.length; i++) {
}

for (var i = 0; i < list.length; i += 1) {
}

// Example of correct code

list.forEach(function(item) {

});
for (const item of list) {
}