usePushDo not append with array[array.size()] = value or array[array.length] = value. Use array.push(value) instead.small-rules/no-array-size-assignmentDisallow array append assignments using array[array.size()] = value (roblox-ts) or array[array.length] = value (standard) and prefer push-based appends.
array[array.size()] = value works but it’s goofy. Just use array.push(value) – clearer, faster, and it
matches what every JS dev expects. Or even better… use array[size++] = value like what was mentioned in
the rationale for no-increment-decrement.
This flags any assignment where the index is the array’s own size. Auto-fixes to .push() when the target
is simple. If the assignment references the array in a way that would change semantics (like
array[array.size()] = array[array.size() - 1]), it won’t touch it. allowAutofix is off by default so you
can review each one.
usePushDo not append with array[array.size()] = value or array[array.length] = value. Use array.push(value) instead.This rule accepts one options object after the severity.
array[array.size()] = value;After auto-fix
array.push(value);array.push(value);