navigation

NoMutatorFunctions (FL0098)

Cause

A mutator function (that mutates one or more of its parameters) was used.

Rationale

Using pure functions without side-effects is preferrable in functional programming.

How To Fix

Use pure function.

Rule Settings

{
    "noMutatorFunctions": {
        "enabled": true,
        "config": {
          "allowedMutatorFunctions": [],
          "additionalMutatorFunctions": []
        }
    }
}
  • allowedMutatorFunctions - list of strings representing mutator functions to allow (e.g. "Array.set").
  • additionalMutatorFunctions - list of strings representing additional mutator functions to disallow.

If a string in either of those settings ends in .* (e.g. Foo.Bar.Baz.*), then it is treated as type Foo.Bar.Baz (without type parameters). In this case, usage of type's constructors is checked.