You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As you can see, typing such an array explicitly can be a bit cumbersome/verbose.
Proposal
Similar to how the no-object-mutation rule deals with objects, the rule would use type information to detect arrays and warn about using methods such as push, pop, shift and others.
The text was updated successfully, but these errors were encountered:
yenbekbay
changed the title
Proposal: new rule for prohibiting usage of mutable array methods
Proposal: New rule for prohibiting usage of mutable array methods
Feb 14, 2018
yenbekbay
changed the title
Proposal: New rule for prohibiting usage of mutable array methods
Proposal: New rule for prohibiting usage of mutating array methods
Feb 14, 2018
This sounds like a nice complement to the no-object-mutation rule, something likeno-array-mutation. I would be happy to take a PR for it, or I'll look into it when I have some spare time.
It would be great to have a rule that warns about using mutating array methods without explicitly typing the arrays with
ReadonlyArray
.Context
In some cases, it's not desirable to explicitly type arrays with
ReadonlyArray
. For example, when the type of an array can be automatically inferred:vs
As you can see, typing such an array explicitly can be a bit cumbersome/verbose.
Proposal
Similar to how the
no-object-mutation
rule deals with objects, the rule would use type information to detect arrays and warn about using methods such aspush
,pop
,shift
and others.The text was updated successfully, but these errors were encountered: