oxc-project/oxc · error · OxcDiagnostic
Assignment to property of function parameter '{name}'.
Error message
Assignment to property of function parameter '{name}'. What it means
Lint diagnostic from eslint/no-param-reassign: a property of a function parameter is assigned. This mutates the caller's object (hidden side effect) and couples the function to the argument's internal shape; it fires even when plain parameter reassignment is allowed via props:true.
Source
Thrown at crates/oxc_linter/src/rules/eslint/no_param_reassign.rs:26
use oxc_ecmascript::BoundNames;
use oxc_macros::declare_oxc_lint;
use oxc_semantic::{AstNode, NodeId};
use oxc_span::Span;
use crate::{
context::LintContext,
rule::{DefaultRuleConfig, Rule},
utils::deserialize_regex_vec,
};
fn assignment_to_param_diagnostic(name: &str, span: Span) -> OxcDiagnostic {
OxcDiagnostic::warn(format!("Assignment to function parameter '{name}'."))
.with_help("Consider using a different variable to avoid unintended side effects on the parameter.")
.with_label(span)
}
fn assignment_to_param_property_diagnostic(name: &str, span: Span) -> OxcDiagnostic {
OxcDiagnostic::warn(format!("Assignment to property of function parameter '{name}'."))
.with_help("Consider using a different variable to avoid unintended side effects on the parameter's properties.")
.with_label(span)
}
#[derive(Debug, Default, Clone, Deserialize, JsonSchema)]
#[serde(rename_all = "camelCase", default, deny_unknown_fields)]
struct NoParamReassignConfig {
/// When true, also check for modifications to properties of parameters.
props: bool,
/// An array of parameter names whose property modifications should be ignored.
ignore_property_modifications_for: FxHashSet<String>,
/// An array of regex patterns (as strings) for parameter names whose property modifications should be ignored.
/// Note that this uses [Rust regex syntax](https://docs.rs/regex/latest/regex/) and so may not have all features
/// available to JavaScript regexes.
#[serde(default, deserialize_with = "deserialize_regex_vec")]
#[schemars(with = "Vec<String>", default)]
ignore_property_modifications_for_regex: Vec<Regex>,
}View on GitHub (pinned to e1e7af627c)
Solutions
- Copy the parameter (e.g. const opts = { ...options }) and modify the copy
- Return a new object with the changed property instead of mutating
- List the parameter in ignorePropertyModificationsFor if mutation is deliberate (e.g. accumulators)
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at crates/oxc_linter/src/rules/eslint/no_param_reassign.rs:26 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of oxc-project/oxc@e1e7af627c (2026-08-20).
Data as JSON: /api/errors/bb3cef07d0d3121c.
Report an issue: GitHub.