no-unreadable-for-of-expression
UnreleasedConfiguration
Rule details
Keep for…of and for await…of loop headers easy to read by assigning
complex iterable expressions to a variable before the loop.
The rule allows identifiers, literals, arrays, dot-property chains, and calls
with simple arguments, such as Object.values(object) and
Iterator.zip([names, scores]). It reports lazy iterator helpers such as
Iterator.from(items).map(transform). The no-duplicate-loops rule handles
ordinary .map() and .filter() calls directly in loop headers.
Examples of incorrect code for this rule
Examples of correct code for this rule
Options
This rule has no options. It reports diagnostics without fixes or suggestions.
Differences from upstream
In a TypeScript project, Rslint reports a loop header such as
for (const row of factories.rows().map(format)) when factories.rows()
returns IteratorObject<Row>. Unicorn v79.0.0 with syntax-only TypeScript
linting leaves that loop header unreported.