prefer-readonly-parameter-types
💼 This rule is enabled in the ✅ recommended config.
Require function parameters to be typed as readonly to prevent accidental mutation of inputs.
⚙️ This rule is configurable.
💭 This rule requires type information.
This is the same thing as the @typescript-eslint/prefer-readonly-parameter-types rule, with the follow changes:
- The
allowarray is hard-coded to always containReadonlyMapandReadonlySet. - An additional option of "onlyRecordsArraysMapsSet" is added. This option will make the rule only examine a function parameter if it is a record, an array, a tuple, a map, or a set. (In other words, only "simple" types.) The option defaults to true. The motivation behind this option is that it reduces a ton of false positives, which still retaining the core value of the rule.