Dont-Reassign-Foreach-Variables¶
Sourcery rule id: dont-reassign-foreach-variables
¶
Description¶
Don't reassign the for-each variable ${var}
Match¶
for (var str of strings) {
str = "";
}
Explanation¶
Reassigning the iteratee in a for-of loop may lead to unexpected behaviour, and the variable should be treated as if it were constant.