no-array-reverse
UnreleasedConfiguration
rslint.config.ts
Rule Details
Prefer Array#toReversed() over the mutating Array#reverse() method. The rule provides editor suggestions, not an automatic fix, because changing whether the original array is mutated requires an explicit choice.
Examples of incorrect code:
Examples of correct code:
For a single spread, suggestions let you either remove the spread when its value is an array or retain it for another iterable. Optional member access is preserved; optional calls and computed method names are not checked.
Options
allowExpressionStatement
Type: boolean
Default: true
By default, a direct array.reverse() expression statement is allowed. A spread-copy mutation is still reported. Set allowExpressionStatement to false to report direct expression statements too.