avoidConstructThenMapDo not map directly on table.create(...) or new Array(...). Allocate first, then write by index in a loop.table.create().map()small-rules/no-table-create-mapDisallow map(...) directly on table.create(...) and new Array(...) constructor patterns in roblox-ts.
This pattern shows up too often. table.create(...).map(...) allocates an intermediate table, throws away
the function allocation when .map() returns, and allocates another table for the result. Two allocations
for a job that needs one.
Just write it: loop and assign by index, or use an array literal. One allocation, no intermediate garbage.
Readability: table.create().map() looks like you’re transforming an existing table, but you’re
building a new one from scratch.
Same applies to new Array(n).map(...). Allocate first, then write. Hate this pattern.
avoidConstructThenMapDo not map directly on table.create(...) or new Array(...). Allocate first, then write by index in a loop.This rule does not accept options.
const mapped = table.create(total).map((_, index) => index);table.create(entries);