ignore parameter assignments to specific variables with no-param-reassign enabled
See original GitHub issueWhat version of ESLint are you using? 2.11.1
With angular you often see patterns like
app.controller('MyCtrl', function($scope) {
$scope.something = true;
});
It would be nice to be able to setup eslint to strictly lint everything but ignore assignments to $scope (if configured to ignore $scope)
Issue Analytics
- State:
- Created 7 years ago
- Reactions:16
- Comments:44 (24 by maintainers)
Top Results From Across the Web
How to avoid no-param-reassign when setting a property ...
If you assign to a parameter and then try and access some of the parameters via the arguments object, it can lead to...
Read more >no-param-reassign - ESLint - Pluggable JavaScript Linter
Assignment to variables declared as function parameters can be misleading and lead to confusing behavior, as modifying function parameters will also mutate ...
Read more >Remove Assignments to Parameters
Problem: Some value is assigned to a parameter inside method's body. Solution: Use a local variable instead of a parameter.
Read more >Writing Reducers with Immer | Redux Toolkit - JS.ORG
One of the primary rules of Redux is that our reducers are never allowed to ... ESLint rule to ignore mutations and assignment...
Read more >List of available rules - ESLint - Pluggable JavaScript linter
disallow assignment operators in conditional expressions ... disallow catch clause parameters from shadowing variables in the outer scope.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Okay, this needs a champion and I’ll step up.
My proposed changes are: Add an optional array to the configuration of
no-param-reassigned
calledignorePropertiesFor
It contains strings naming variables for which property assignments/modifications will be not be flagged as an error.The configuration would look like:
With that configuration the following code would not produce errors:
but this would report the usual property assignment errors:
If one would just use
["error", { "proprs": false }]
as configuration the last example and similar things would not be caught which is why I would like to propose that change and also implemented it already.