Chore: enable no-param-reassign on ESLint codebase #10065
What is the purpose of this pull request? (put an "X" next to item)
[x] Other, please explain:
What changes did you make? (Give an overview)
This enables the
I think reassigning parameters generally makes code harder to read, because it's not possible to skip over a part of a function and assume that the parameter names still refer to the same objects. This is especially true since we require JSDoc comments in our codebase -- after reassigning a parameter, the JSDoc comment is generally inaccurate for the new assigned value.
Is there anything you'd like reviewers to focus on?
Nothing in particular
ilyavolodin left a comment
Code changes looks good, however, I'm not sure about enabling
@ilyavolodin Sorry about that. I personally think it's worth enabling the rule since there is usually a better option than reassigning a parameter, and IMO the rule helps in a vast majority of cases. However, I'd be fine with reverting if you feel strongly about not enabling the rule.
It's also worth noting that we'll be able to use default parameters soon when we drop support for Node 4, which will make it easier to have default values without reassigning parameters.