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
Fix: Allow duplicated let declarations in prefer-const
(fixes #7712)
#7717
Conversation
LGTM |
@not-an-aardvark, thanks for your PR! By analyzing the history of the files in this pull request, we identified @mysticatea, @NickHeiner and @vitorbal to be potential reviewers. |
LGTM |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thank you!
Due to acornjs/acorn#487, espree does not throw a syntax error for duplicate `let` or `const` declarations. Previously, the `prefer-const` rule assumed that a `let` variable would always have exactly one declaration. This adds a sanity check to avoid reporting (and possibly creating incorrect autofixes) a `let` variable if it has more than one declaration.
191aaea
to
649eb90
Compare
LGTM |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thanks!
What is the purpose of this pull request? (put an "X" next to item)
[x] Bug fix
See #7712
What changes did you make? (Give an overview)
Due to acornjs/acorn#487, espree does not throw a syntax error for duplicate
let
orconst
declarations. Previously, theprefer-const
rule assumed that alet
variable would always have exactly one declaration. This adds a sanity check to avoid reporting (and possibly creating incorrect autofixes from) alet
variable if it has more than one declaration.Is there anything you'd like reviewers to focus on?
Nothing in particular.