• Assignment to property of function parameter no-param-reassign

avatar

Last updated: Mar 7, 2024 Reading time · 3 min

banner

# Table of Contents

  • Disabling the no-param-reassign ESLint rule for a single line
  • Disabling the no-param-reassign ESLint rule for an entire file
  • Disabling the no-param-reassign ESLint rule globally

# Assignment to property of function parameter no-param-reassign

The ESLint error "Assignment to property of function parameter 'X' eslint no-param-reassign" occurs when you try to assign a property to a function parameter.

To solve the error, disable the ESLint rule or create a new object based on the parameter to which you can assign properties.

assignment to property of function parameter eslint no param reassign

Here is an example of how the error occurs.

The ESLint rule forbids assignment to function parameters because modifying a function's parameters also mutates the arguments object and can lead to confusing behavior.

One way to resolve the issue is to create a new object to which you can assign properties.

We used the spread syntax (...) to unpack the properties of the function parameter into a new object to which we can assign properties.

If you need to unpack an array, use the following syntax instead.

The same approach can be used if you simply need to assign the function parameter to a variable so you can mutate it.

We declared the bar variable using the let keyword and set it to the value of the foo parameter.

We are then able to reassign the bar variable without any issues.

# Disabling the no-param-reassign ESLint rule for a single line

You can use a comment if you want to disable the no-param-reassign ESLint rule for a single line.

Make sure to add the comment directly above the assignment that causes the error.

# Disabling the no-param-reassign ESLint rule for an entire file

You can also use a comment to disable the no-param-reassign ESLint rule for an entire file.

Make sure to add the comment at the top of the file or at least above the function in which you reassign parameters.

The same approach can be used to disable the rule only for a single function.

The first comment disables the no-param-reassign rule and the second comment enables it.

If you try to reassign a parameter after the second comment, you will get an ESLint error.

# Disabling the no-param-reassign ESLint rule globally

If you need to disable the no-param-reassign rule globally, you have to edit your .eslintrc.js file.

disable no param reassign rule globally

If you only want to be able to assign properties to an object parameter, set props to false instead of disabling the rule completely.

The following code is valid after making the change.

If you use a .eslintrc or .eslintrc.json file, make sure to double-quote the properties and values.

If you want to only allow assignment to object parameters, use the following line instead.

Make sure all properties are double-quoted and there are no trailing commas if your config is written in JSON.

# Additional Resources

You can learn more about the related topics by checking out the following tutorials:

  • eslint is not recognized as an internal or external command
  • Plugin "react" was conflicted between package.json » eslint-config-react-app
  • React: Unexpected use of 'X' no-restricted-globals in ESLint
  • TypeScript ESLint: Unsafe assignment of an any value [Fix]
  • ESLint error Unary operator '++' used no-plusplus [Solved]
  • ESLint Prefer default export import/prefer-default-export
  • Arrow function should not return assignment. eslint no-return-assign
  • TypeError: Cannot redefine property: X in JavaScript [Fixed]
  • ESLint: disable multiple rules or a rule for multiple lines
  • Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
  • Missing return type on function TypeScript ESLint error

book cover

Borislav Hadzhiev

Web Developer

buy me a coffee

Copyright © 2024 Borislav Hadzhiev

Understanding ESLint's `no-param-reassign` Rule for Clearer Functions

When you define a function, you can specify variables that the function will receive as input. These are called parameters. The no-param-reassign rule discourages directly changing the value of these parameters within the function.

There are two reasons for this:

  • Clarity: If you modify a parameter inside the function, it can be confusing for someone reading the code to understand what the function does. They might expect the parameter value to stay the same throughout the function.
  • Unexpected behavior: In JavaScript, there's a concept called the arguments object. This object holds the values of all the arguments passed to a function. If you change a parameter inside the function, it can also unintentionally modify the arguments object, leading to unexpected results.

Are there exceptions?

There are some cases where reassigning a parameter might be necessary. For instance, you might be working with an object and want to modify one of its properties. In these cases, ESLint provides ways to configure the no-param-reassign rule to allow such modifications while still catching unintended changes.

Strict mode and no-param-reassign

If your code is written in strict mode (a more secure way to write JavaScript), the no-param-reassign rule becomes less important. Strict mode already offers some protections against unintended modifications of the arguments object.

  • You'll see an error message from ESLint when you try to directly reassign a parameter value within a function. This typically looks like no-param-reassign: Assignment to function parameter '<parameter_name>' .

Troubleshooting:

Configure no-param-reassign : ESLint allows some configuration for this rule. You can:

  • Ignore Specific Parameters: If certain parameters are meant to be modified (like state in state management libraries), you can configure no-param-reassign to ignore those specific names.
  • Allow Property Modifications: You can allow modifications to properties of objects passed as parameters while still disallowing complete reassignment.

Code Examples for no-param-reassign Rule

This code triggers a no-param-reassign error because it tries to change the value of the x parameter directly:

Fix: Working with the Parameter's Value

Here, we avoid the error by using the original parameter value ( num ) within the function:

Error: Modifying an Object Property

This code attempts to modify a property ( name ) of the object passed as a parameter, which can also trigger the error in some configurations:

Fix: Ignoring Property Modifications (Configuration)

If modifying object properties is intended, you can configure no-param-reassign to allow it:

Allowed Scenario: Working with Copies (Array)

This code demonstrates a case where creating a copy of the parameter (array) is necessary for modification:

Destructuring with Default Values:

  • When defining the function, you can use destructuring with default values for parameters. This allows you to provide a fallback value if no argument is passed, avoiding the need to reassign later.

Early Return with Modified Copy:

  • If you need to modify data passed as a parameter (like an object or array), consider creating a copy early on and working with the copy. Then, return the modified copy from the function.

Functional Programming Techniques:

Purpose:Controls which imports are allowed in your JavaScript code.Helps enforce coding standards and prevent potential issues

What is ESLint?ESLint is a popular tool for JavaScript developers that helps enforce coding style and identify potential errors

What it does: It checks your code for any variables that you use but haven't properly declared using var, let, or const

Having unused variables can clutter up your code and make it harder to read for you and other programmers. It also might indicate a bug if a variable was meant to be used but isn't. The no-unused-vars rule helps you find these unused variables and clean up your code

Here's a breakdown of how it works:What it catches: The rule flags any instance where you reference a variable, function

Here's what the rule considers "useless":Simply re-throwing the error: If your catch block just catches an error and then throws it again without any modification or handling

Here's how it works:Escapes in Strings: In JavaScript, backslashes (\) are used to escape characters that might otherwise have special meanings within strings

no-param-reassign

Disallow reassigning function parameters

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.

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.

Rule Details

This rule aims to prevent unintended behavior caused by modification or reassignment of function parameters.

Examples of incorrect code for this rule:

Examples of correct code for this rule:

This rule takes one option, an object, with a boolean property "props" , and arrays "ignorePropertyModificationsFor" and "ignorePropertyModificationsForRegex" . "props" is false by default. If "props" is set to true , this rule warns against the modification of parameter properties unless they’re included in "ignorePropertyModificationsFor" or "ignorePropertyModificationsForRegex" , which is an empty array by default.

Examples of correct code for the default { "props": false } option:

Examples of incorrect code for the { "props": true } option:

Examples of correct code for the { "props": true } option with "ignorePropertyModificationsFor" set:

Examples of correct code for the { "props": true } option with "ignorePropertyModificationsForRegex" set:

When Not To Use It

If you want to allow assignment to function parameters, then you can safely disable this rule.

This rule was introduced in ESLint v0.18.0.

Further Reading

JavaScript: Don’t Reassign Your Function Arguments

  • Rule source
  • Tests source

© OpenJS Foundation and other contributors Licensed under the MIT License. https://eslint.org/docs/latest/rules/no-param-reassign

Disallow Reassignment of Function Parameters (no-param-reassign)

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.

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.

Rule Details

This rule aims to prevent unintended behavior caused by modification or reassignment of function parameters.

Examples of incorrect code for this rule:

Examples of correct code for this rule:

This rule takes one option, an object, with a boolean property "props" and an array "ignorePropertyModificationsFor" . "props" is false by default. If "props" is set to true , this rule warns against the modification of parameter properties unless they’re included in "ignorePropertyModificationsFor" , which is an empty array by default.

Examples of correct code for the default { "props" : false } option:

Examples of incorrect code for the { "props" : true } option:

Examples of correct code for the { "props" : true } option with "ignorePropertyModificationsFor" set:

When Not To Use It

If you want to allow assignment to function parameters, then you can safely disable this rule.

Further Reading

  • JavaScript: Don’t Reassign Your Function Arguments

This rule was introduced in ESLint 0.18.0.

  • Rule source
  • Documentation source

Disallow Reassignment of Function Parameters (no-param-reassign)

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.

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.

Rule Details

This rule aims to prevent unintended behavior caused by modification or reassignment of function parameters.

Examples of incorrect code for this rule:

Examples of correct code for this rule:

This rule takes one option, an object, with a boolean property "props" and an array "ignorePropertyModificationsFor" . "props" is false by default. If "props" is set to true , this rule warns against the modification of parameter properties unless they're included in "ignorePropertyModificationsFor" , which is an empty array by default.

Examples of correct code for the default { "props": false } option:

Examples of incorrect code for the { "props": true } option:

Examples of correct code for the { "props": true } option with "ignorePropertyModificationsFor" set:

When Not To Use It

If you want to allow assignment to function parameters, then you can safely disable this rule.

Further Reading

  • JavaScript: Don’t Reassign Your Function Arguments

This rule was introduced in ESLint 0.18.0.

  • Rule source
  • Documentation source

noParameterAssign

Diagnostic Category: lint/style/noParameterAssign

  • JavaScript (and super languages)

Since : v1.0.0

  • Same as: no-param-reassign

Disallow reassigning function parameters.

Assignment to a function parameters can be misleading and confusing, as modifying parameters will also mutate the arguments object. It is often unintended and indicative of a programmer error.

In contrast to the ESLint rule, this rule cannot be configured to report assignments to a property of a parameter.

Related links

  • Disable a rule
  • Configure the rule fix
  • Rule options

Get the Reddit app

This subreddit is for anyone who wants to learn JavaScript or help others do so. Questions and posts about frontend development in general are welcome, as are all posts pertaining to JavaScript on the backend.

Why eslint throws "Assignment to property of function parameter 'element'." for this?

I started learning javascript a week ago. Started using eslint yesterday and it's very useful. I have been trying this part of the code for sometime now and eslint keeps throwing Assignment to property of function parameter 'element'. Here is the code;

Before this I was doing something like this;

I know eslint isn't showing error for nothing so I would like to know what's reason and how it should be done.

And I have another eventListner with same pattern but that changes the opacity to 0 and pointerEvents to 'none'. So is there a way to do that using ternary operator or should I just stick to if else for that?Thanks and lemme know if there anything else I can improve.

By continuing, you agree to our User Agreement and acknowledge that you understand the Privacy Policy .

Enter the 6-digit code from your authenticator app

You’ve set up two-factor authentication for this account.

Enter a 6-digit backup code

Create your username and password.

Reddit is anonymous, so your username is what you’ll go by here. Choose wisely—because once you get a name, you can’t change it.

Reset your password

Enter your email address or username and we’ll send you a link to reset your password

Check your inbox

An email with a link to reset your password was sent to the email address associated with your account

Choose a Reddit account to continue

  • Stack Overflow for Teams Where developers & technologists share private knowledge with coworkers
  • Advertising & Talent Reach devs & technologists worldwide about your product, service or employer brand
  • OverflowAI GenAI features for Teams
  • OverflowAPI Train & fine-tune LLMs
  • Labs The future of collective knowledge sharing
  • About the company Visit the blog

Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Get early access and see previews of new features.

Fixing no-param-reassign Eslint issue in function

With below code, I am getting ESlint error Assignment to property of function parameter 'recurrence' at many places where I // eslint-disable-next-line no-param-reassign disabled the line. I dont want to use disable. How so solve this issue without using disable as legit way? Can anyone help me with this? THanks

  • ecmascript-6

Zeus Carl's user avatar

You can assign recurrence to a const variable in side the function and use that in side the function.

Nazeer's user avatar

  • So Now I have to replace recurrence.frequency with recurrenceValue.frequency every place where recurrence is used? –  Zeus Carl Commented Sep 23, 2020 at 6:50
  • 1 yes exactly. or just a simply change the parameter name to something else and set const variable name as recurrence . so now you don't have to replace everywhere. –  Nazeer Commented Sep 23, 2020 at 8:00
  • Thanks.... Can you help me here too? stackoverflow.com/questions/64023755/… –  Zeus Carl Commented Sep 23, 2020 at 8:17

Your Answer

Reminder: Answers generated by artificial intelligence tools are not allowed on Stack Overflow. Learn more

Sign up or log in

Post as a guest.

Required, but never shown

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy .

Not the answer you're looking for? Browse other questions tagged javascript node.js reactjs ecmascript-6 or ask your own question .

  • The Overflow Blog
  • Scaling systems to manage all the metadata ABOUT the data
  • Navigating cities of code with Norris Numbers
  • Featured on Meta
  • We've made changes to our Terms of Service & Privacy Policy - July 2024
  • Bringing clarity to status tag usage on meta sites
  • Tag hover experiment wrap-up and next steps

Hot Network Questions

  • With 42 supernovae in 37 galaxies, how do we know SH0ES results is robust?
  • In "Take [action]. When you do, [effect]", is the action a cost or an instruction?
  • Making wobbly 6x4’ table stable
  • Do "Whenever X becomes the target of a spell" abilities get triggered by counterspell?
  • Conditional environment using package option
  • Cardano full node disk space needed
  • Smallest natural number unrepresentable by fifty letters
  • How to cite a book if only its chapters have DOIs?
  • Get the first character of a string or macro
  • Why would Space Colonies even want to secede?
  • AGPL/Commercial software
  • Erase the loops
  • How do you "stealth" a relativistic superweapon?
  • Returning to France with a Récépissé de Demande de Carte de Séjour stopping at Zurich first
  • Can't figure out this multi-wire branch circuit
  • A post-apocalyptic short story where very sick people from our future save people in our timeline that would be killed in plane crashes
  • Blocking between two MERGE queries inserting into the same table
  • A study on the speed of gravity
  • Would several years of appointment as a lecturer hurt you when you decide to go for a tenure-track position later on?
  • How do *Trinitarians* explain why Jesus didn't mention the Holy Spirit in Matthew 24:36 regarding his return?
  • How would a culture living in an extremely vertical environment deal with dead bodies?
  • Do POVM and generalized measurements really describe all possible measurements we can do on a quantum system (open dynamics)?
  • Power line crossing data lines via the ground plane
  • Someone wants to pay me to be his texting buddy. How am I being scammed?

eslint assignment to property of function parameter 'value'.(no param reassign)

Navigation Menu

Search code, repositories, users, issues, pull requests..., provide feedback.

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly.

To see all available qualifiers, see our documentation .

  • Notifications You must be signed in to change notification settings

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement . We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

no-param-reassign: add option to ignore property assignment for whitelisted callers #9670

@dzaman

dzaman commented Nov 30, 2017


no-param-reassign


Fewer


New option - allow whitelisted (optional) object & function pairs


There are times when it's desirable to mutate argument properties based on the caller of an iteratee. For example, a that mutates the accumulator instead of copying can be several orders of magnitude faster.

It is possible to white list in , but using descriptive names for accumulators is preferable.

Open to suggestions about the option name and format.


Errors: Assignment to property of function parameter 'acc'.


Ignore mutated arguments if the function's caller is whitelisted.

@eslint-deprecated

not-an-aardvark commented Nov 30, 2017 • edited Loading

Thanks for the proposal. For what it's worth, this option was also proposed in and was not accepted.

that mutates the accumulator instead of copying can be several orders of magnitude faster

I assume you're comparing to code like this, which takes quadratic time:

.reduce((acc, value, key) => ({ ...acc, [key]: true }), {})

However, there's a better way to do this in linear time (and with similar performance to the mutation example):

.assign({}, ...array.map((value, key) => ({ [key]: true })))

Sorry, something went wrong.

@clshortfuse

clshortfuse commented Dec 14, 2017

Parameter reassignment is fundamental to ES6 Proxies.

@zargold

zargold commented Dec 20, 2017 • edited Loading

Ok but what about:
All I care about here is those 2 items the ones with names 'Gender' and 'NewItem' out of a large array... I need to extract those 2 items and sure I could loop through the large array with .find() but it is a array and why should I?
I think in general with reduce you are often assigning to the object basically if you ever use an {} as the aggregator param in reduce you're probably assigning to it.

getGenderNewParam = ItemsById => ItemsById.reduce((itemsICareAbout, item) => { /* eslint-disable no-param-reassign */ if (item.name === 'Gender') { itemsICareAbout.gender = item } if (item.name === 'NewItem') { itemsICareAbout.newToSale = item } return itemsICareAbout /* eslint-enable no-param-reassign */ }, {}) const { gender, newToSale } = getGenderNewParam(useCase)

clshortfuse commented Dec 20, 2017

You can get around this by using which is what I'm using for ES6 Proxies.

That is pretty cool and sounds safe not sure what the advantage of using this over or (if I know for sure this is an object because I had just done ) is there one?

I think the real advantage of having ESlint complain is, for example, when the eslint rule no-prototype-builtins complains that someone accidentally tries to use ambiguousArgument.hasOwnProperty that isn't necessarily an object it will scream at them and help them prevent an issue.

But when you're using an object that you know is definitely an object because you just said , then the rule is not so helpful (and I'm fine doing ) but this isn't reflecting the advantages of ESlint. The rule's intent is to make your life easier by preventing mistakenly trying to using .hasOwnProperty on a non-object, but in this case you can't be making that mistake.

ESlint is great when it helps prevent you from making and makes sure everyone keeps the same coding standards (at least IMO). But if there's no potential mistake or unintended consequences, and it is well-written intentional code with good standards, then people end up writing unnecessary hacks/work arounds to prevent something screaming at them which itself has unintentional consequences.

Same thing with no-param-reassign it has the intent that you not alter arguments that are outside of this scope which might have unintended side effects. On the other hand, when you just brought in an empty object to perform mutations on it you don't care whether anything will be assigned to it and you actually just created it for mutating it--you created it within the function it is not really a param that you are reassigning to. It is a placeholder that you put in (when you use reduce). At least, I view that to be the intent to prevent mutations to externally scoped object references.

@platinumazure

not-an-aardvark commented Jan 19, 2018

Thanks for your interest in improving ESLint. Unfortunately, it looks like this issue didn't get consensus from the team, so I'm closing it. We define as having three 👍s from team members, as well as a team member willing to champion the proposal. This is a high bar by design -- we can't realistically accept and maintain every feature request in the long term, so we only accept feature requests which are useful enough that there is consensus among the team that they're worth adding.

Since ESLint is pluggable and can load custom rules at runtime, the lack of consensus among the ESLint team doesn't need to be a blocker for you using this in your project, if you'd find it useful. It just means that you would need to yourself, rather than using a bundled rule that is packaged with ESLint.

@not-an-aardvark

No branches or pull requests

@platinumazure

IMAGES

  1. no-param-reassign

    eslint assignment to property of function parameter 'value'.(no param reassign)

  2. 解决Vue、vuex报“Assignment to property of function parameter ‘state‘” 的方法

    eslint assignment to property of function parameter 'value'.(no param reassign)

  3. Assignment to property of function parameter no-param-reassign

    eslint assignment to property of function parameter 'value'.(no param reassign)

  4. 一些eslint的报红及解决

    eslint assignment to property of function parameter 'value'.(no param reassign)

  5. javascript

    eslint assignment to property of function parameter 'value'.(no param reassign)

  6. Assignment to property of function parameter 'XXX' no-param-reassign 记录

    eslint assignment to property of function parameter 'value'.(no param reassign)

COMMENTS

  1. Assignment to property of function parameter (no-param-reassign)

    10. This is a common ESLint issue that appears frequently on old codebase. You have modified the result variable which was passed as parameter. This behavior is prohibited by the rule. To resolve it, copy the argument to a temporary variable and work on it instead: export const fn = article => article.categoryValueDtoSet.reduce((res, item) => {.

  2. no-param-reassign

    If you want to allow assignment to function parameters, then you can safely disable this rule. 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. Version

  3. Assignment to property of function parameter no-param-reassign

    function createEmployee(emp) { // ⛔️ Assignment to property of function parameter 'emp'. eslint no-param-reassign. emp.name = 'bobby hadz'; emp.salary = 500; return emp; } The ESLint rule forbids assignment to function parameters because modifying a function's parameters also mutates the arguments object and can lead to confusing behavior.

  4. no-param-reassign

    A pluggable and configurable linter tool for identifying and reporting on patterns in JavaScript. Maintain your code quality with ease.

  5. Understanding ESLint's no-param-reassign Rule for Clearer Functions

    The no-param-reassign rule discourages directly changing the value of these parameters within the function. There are two reasons for this: Clarity: If you modify a parameter inside the function, it can be confusing for someone reading the code to understand what the function does.

  6. No-param-reassign

    Rule Details. This rule aims to prevent unintended behavior caused by modification or reassignment of function parameters. Examples of incorrect code for this rule: /*eslint no-param-reassign: "error"*/ function foo(bar) {. bar = 13; } function foo(bar) {. bar++; } function foo(bar) { for (bar in baz) {} } function foo(bar) { for (bar of baz) {} }

  7. no-param-reassign

    Options. This rule takes one option, an object, with a boolean property "props" and an array "ignorePropertyModificationsFor"."props" is false by default. If "props" is set to true, this rule warns against the modification of parameter properties unless they're included in "ignorePropertyModificationsFor", which is an empty array by default.. props ...

  8. no-param-reassign

    Disallow Reassignment of Function Parameters (no-param-reassign) 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. ... Disallow Reassignment of Function Parameters (no-param-reassign) Assignment to variables declared ...

  9. no-func-assign

    A pluggable and configurable linter tool for identifying and reporting on patterns in JavaScript. Maintain your code quality with ease.

  10. no-param-reassign

    Disallow Reassignment of Function Parameters (no-param-reassign) ... /*eslint no-param-reassign: "error"*/ function foo (bar) { bar = 13; } ... If you want to allow assignment to function parameters, then you can safely disable this rule. Further Reading. JavaScript: Don't Reassign Your Function Arguments ...

  11. noParameterAssign

    Same as: no-param-reassign; Disallow reassigning function parameters. Assignment to a function parameters can be misleading and confusing ... In contrast to the ESLint rule, this rule cannot be configured to report assignments to a property of a parameter. Examples Section titled Examples. Invalid Section titled Invalid.

  12. ignore parameter assignments to specific variables with no-param

    It's not a conflict so much as an exception: We enforce that property reassignment is enforced by no-param-reassign except properties of the identifiers named in the option. Yes, you've understood the example correctly. And yes, props: true would be necessary for this to even come into effect (assuming props is normally false by default).

  13. no-param-reassign: function type exceptions #6339

    eslint output: Assignment to function parameter 'line' no-param-reassign. In such cases creation an intermediate variable could be overcomplication. May be some additions to the rule like proxyTraps: false, eventListeners: false would be helpful.

  14. Option to disable no-param-reassign per function scope #8907

    Thanks @ilyavolodin.I meant a function-level comment like // eslint-disable-func no-param-reassign to disable the check for the entire function (or block) that line was found in.. Anyway, compared to your solution, my proposal would only save one line of comments, so probably the current way to wrap the function between /* eslint-disable no-param-reassign */ and /* eslint-enable */ is good enough.

  15. ESLint: Assignment to property of function parameter

    ESLint: Assignment to property of function parameter. Ask Question Asked 5 years, 6 months ago. Modified 5 years, ... Assignment to property of function parameter (no-param-reassign) 6. ... Why is a datetime value returned that matches the predicate value when using greater than comparison

  16. Do we want to recommend the `no-param-reassign` eslint rule in the docs

    I just had this idea when another user tried to assign to the state function argument. There is actually an eslint rule for that: no-param-reassign. I'd suggest we either add that rule as a recommendation somehwere in the docs or go even one step farther and create a shareable config package .. That way we could add some more recommended rules in the future.

  17. Why eslint throws "Assignment to property of function parameter

    I started learning javascript a week ago. Started using eslint yesterday and it's very useful. I have been trying this part of the code for sometime now and eslint keeps throwing Assignment to property of function parameter 'element'. Here is the code;

  18. Fixing no-param-reassign Eslint issue in function

    yes exactly. or just a simply change the parameter name to something else and set constvariable name as recurrence. so now you don't have to replace everywhere. - Nazeer Commented Sep 23, 2020 at 8:00

  19. no-param-reassign: add option to ignore property assignment for

    Ok but what about: All I care about here is those 2 items the ones with names 'Gender' and 'NewItem' out of a large array... I need to extract those 2 items and sure I could loop through the large array with .find() but it is a large array and why should I? I think in general with reduce you are often assigning to the object basically if you ever use an {} as the aggregator param in reduce you ...