Rule: forin
Requires a for ... in
statement to be filtered with an if
statement.
Rationale
ts
for (let key in someObject) {
if (someObject.hasOwnProperty(key)) {
// code here
}
}
Prevents accidental interation over properties inherited from an object’s prototype.
See MDN’s for...in
documentation for more information about for...in
loops.
Config
Not configurable.
Examples
"forin": true
Schema
null