Skip to main content

What it flags

orm-query-in-loop, drizzle-query-in-loop and orm-count-materialization preserve the distinction between building a lazy statement and executing it. Counts with pagination, grouping, joins, hooks or scopes need particular care. TypeORM checks also identify entity reads used only for existence (typeorm-existence-materialization), unused wide columns in a direct DTO projection (typeorm-wide-projection), and a loop calling a local private helper that starts a transaction (typeorm-transaction-in-loop). Before changing a projection or an existence check, verify entity-load side effects. For per-row transactions, check rollback, ordering and error reporting before batching. The adapters recognize specific typed APIs. Custom methods with the same name, raw queries and wrappers often have different semantics. A raw read that a Drizzle database’s execute() runs once per loop iteration is reported too, when its argument is a Drizzle sql template that starts with SELECT and contains no ;. With drizzle-orm/pg-core, the result must be awaited or otherwise consumed. A loop that is sequential by design is skipped. So is a template that passes the whole loop collection to IN (...) or = ANY(...). Batch independent reads, and keep the original ordering and missing-row behavior.

Configuration

Set the rule to "off" in loadwise.config.json to drop its findings: