Skip to content

eslint/no-param-reassign Restriction

What it does

Disallow reassigning function parameters or, optionally, their properties.

Why is this bad?

Reassigning parameters can lead to unexpected behavior, especially when relying on the original arguments passed into the function. Mutating parameter properties can be similarly surprising and harder to reason about.

Examples

javascript
function foo(bar) {
  bar = 1;
}

function baz(qux) {
  qux.prop = 2; // when `props` option is enabled
}

How to use

To enable this rule in the CLI or using the config file, you can use:

bash
oxlint --deny no-param-reassign
json
{
  "rules": {
    "no-param-reassign": "error"
  }
}

References

Released under the MIT License.