no-param-reassign
Configuration
rslint.config.ts
Rule Details
Disallow reassigning function parameters. Reassigning a parameter mutates the caller-visible arguments object in non-strict code and can hide bugs caused by unintentional overwrites. With the props option, the rule also forbids modifying properties on parameters.
Examples of incorrect code for this rule:
Examples of correct code for this rule:
Options
props(defaultfalse) — whentrue, assignments to properties of a parameter (e.g.bar.x = 0,delete bar.x,++bar.x) are also reported.ignorePropertyModificationsFor(requiresprops: true) — parameter names for which property modifications are allowed.ignorePropertyModificationsForRegex(requiresprops: true) — regular expressions matching parameter names for which property modifications are allowed.
Examples of incorrect code with { "props": true }:
Examples of correct code with { "props": true, "ignorePropertyModificationsFor": ["bar"] }: