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
feat: add declaration loc to message in block-scoped-var #17252
Conversation
Thanks for this PR! I would suggest to add a test with at least 3 redeclarations of a variable in different blocks, for example: if (foo) {
var a = 1;
} else if (bar) {
var a = 2;
} else {
var a = 3;
} This would let us verify the case of two (or more) messages with the same In the current implementation, when |
I added this test in e85f274, thanks for the suggestion! |
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.
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!
Can we merge PRs or do we need to hold PRs until we finish #17225?
Prerequisites checklist
What is the purpose of this pull request? (put an "X" next to an item)
[ ] Documentation update
[ ] Bug fix (template)
[ ] New rule (template)
[x] Changes an existing rule (template)
[ ] Add autofix to a rule
[ ] Add a CLI option
[ ] Add something to the core
[ ] Other, please explain:
Fixes #17244
What changes did you make? (Give an overview)
In the
block-scoped-var
rule, I added the location info of declarations to reported messages. This should clarify cases where there are multiple errors on the same reference, and seems useful in general.Is there anything you'd like reviewers to focus on?