Skip to content

Commit 7a51d77

Browse files
stephen-hardynzakassnitin315
authored
docs: no-param-reassign mention strict mode (#17494)
* no-param-reassign strict mode mention * Update docs/src/rules/no-param-reassign.md Fixes #17484 Co-authored-by: Nitin Kumar <[email protected]> --------- Co-authored-by: Nicholas C. Zakas <[email protected]> Co-authored-by: Nitin Kumar <[email protected]>
1 parent 9cd7ac2 commit 7a51d77

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

docs/src/rules/no-param-reassign.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ further_reading:
66
---
77

88

9-
Assignment to variables declared as function parameters can be misleading and lead to confusing behavior, as modifying function parameters will also mutate the `arguments` object. Often, assignment to function parameters is unintended and indicative of a mistake or programmer error.
9+
Assignment to variables declared as function parameters can be misleading and lead to confusing behavior, as modifying function parameters will also mutate the `arguments` object when not in strict mode (see [When Not To Use It](#when-not-to-use-it) below). Often, assignment to function parameters is unintended and indicative of a mistake or programmer error.
1010

1111
This rule can be also configured to fail when function parameters are modified. Side effects on parameters can cause counter-intuitive execution flow and make errors difficult to track down.
1212

@@ -183,3 +183,5 @@ function foo(barBaz) {
183183
## When Not To Use It
184184

185185
If you want to allow assignment to function parameters, then you can safely disable this rule.
186+
187+
Strict mode code doesn't sync indices of the arguments object with each parameter binding. Therefore, this rule is not necessary to protect against arguments object mutation in ESM modules or other strict mode functions.

0 commit comments

Comments
 (0)