avoidConstructorEnumerationDo not use Array constructor enumeration arguments. Use an array literal instead.small-rules/no-array-constructor-elementsDisallow array constructor element forms and enforce roblox-ts-aware constructor patterns.
Heads up: new Array(n) is fine here. In roblox-ts it compiles to table.create(n), which is a normal,
welcomed pattern. This rule does NOT flag that.
What it does catch: new Array(a, b, c) (element enumeration — just write [a, b, c]), a bare new Array() with no generic type, and the “declare an empty array then .push() a bunch right after” pattern,
which it collapses into one literal. Auto-fixes when the values are side-effect free.
In standard mode it also bans new Array(n) length constructors, but in roblox-ts that’s allowed. Flip
environment to "standard" if you want the stricter behavior.
avoidConstructorEnumerationDo not use Array constructor enumeration arguments. Use an array literal instead.avoidLengthConstructorInStandardLength-based Array constructor is not allowed in standard mode. Prefer Array.from({ length: n }).avoidSingleArgumentConstructorSingle-argument Array constructor form is not allowed here. Use an array literal instead.collapseArrayPushInitializationCollapse new Array<T>() + consecutive .push(...) calls into a single array literal initializer.requireExplicitGenericOnNewArraynew Array() must use an explicit generic argument or a contextual Array<T>/ReadonlyArray<T> annotation.suggestArrayFromLengthReplace with Array.from({ length: value }).suggestArrayLiteralReplace constructor form with an array literal.suggestCollapseArrayPushInitializationCollapse constructor + push sequence into a single array literal initializer.This rule accepts one options object after the severity.
const values = new Array("a", "b");After auto-fix
const values = ["a", "b"];const value = new Array<string>();