--- ruleName: forin description: 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`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for...in) documentation for more information about `for...in` loops. optionsDescription: Not configurable. options: null optionExamples: - 'true' type: functionality optionsJSON: 'null' layout: rule title: 'Rule: forin' ---