New issue
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
Rule Proposal: disallow the updates of imported bindings #12237
Rule Proposal: disallow the updates of imported bindings #12237
Comments
I guess there is no reason not to use this rule, it should be In Also, the rule should still allow |
Yes, I think so.
Correct. The rule reports for all properties of namespace objects. It's runtime errors regardless of the existence of named exported members.
Correct. |
Would I realize that the actual import isn't technically an assignment statement, but I wonder if it would be easier for most users if they see the initial import as an "assignment", and then the actual assignment (that we warn on) would be a "reassignment". I don't feel strongly about the name, though. |
I prefer
Only one exception is:
|
Need it wait for a major? Code that can’t possibly execute isn’t really “breaking” people to warn on. I think no-import-reassign makes the most sense, since it’s closest to no-param-reassign, conceptually. |
Yes. our Semantic Versioning Policy has declared it. And it might break people that are using ES Modules syntax with bundlers/transpilers. |
New rules can be semver-minor. The only thing that must be semver-major is adding the rule to |
My position is that we should rename I will work on this. |
The first assignment is the function itself; reassign is the correct name imo. |
In my feeling, as I enumerated in #12237 (comment), |
Please describe what the rule should do:
Disallows the updates of imported bindings with ES Modules because such an update will cause runtime errors.
What category of rule is this? (place an "X" next to just one item)
[X] Warns about a potential error (problem)
Provide 2-3 code examples that this rule will warn about:
Why should this rule be included in ESLint (instead of a plugin)?
Because this is an essential of the language feature. This rule is very similar to core rules
no-const-assign
that catches runtime errors.The rule name may be
no-import-assign
.Are you willing to submit a pull request to implement this rule?
Yes.
The text was updated successfully, but these errors were encountered: