Skip to content

No Table Create Map

SuggestionRoblox
small-rules/no-table-create-map

Disallow map(...) directly on table.create(...) and new Array(...) constructor patterns in roblox-ts.

Diagnostic Messages

avoidConstructThenMap
Do not map directly on table.create(...) or new Array(...). Allocate first, then write by index in a loop.

Configuration

This rule does not accept options.

{
"jsPlugins": [
"@pobammer-ts/small-rules"
],
"rules": {
"small-rules/no-table-create-map": "error"
}
}

Examples

table creation followed by map
const mapped = table.create(total).map((_, index) => index);
table creation without mapping
table.create(entries);