no-shadow: allow a declaration's body to reuse the declared variable's name
See original GitHub issueWhat rule do you want to change? no-shadow
Does this change cause the rule to produce more or fewer warnings? Fewer warnings
How will the change be implemented? (New option, new default behavior, etc.)? New default behavior
Please provide some example code that this change will affect:
const person = people.find(person => person.name === "John");
What does the rule currently do for this code?
It currently produces a warning, claiming that the right-hand side person
shadows the left-hand side person
.
What will the rule do after it’s changed? It will not produce warnings when the purportedly-shadowed variable has not been declared.
I believe the current behavior is incorrect, as the variable has not (semantically) been declared at the point where the warning is generated, and so it can not be shadowed.
Are you willing to submit a pull request to implement this change? Yes, though I would need some pointers on how to get started.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:10
- Comments:16 (10 by maintainers)
Top GitHub Comments
I’m going to do this.
The use-case coming up in google/web-stories-wp is:
This false negative from
no-shadow
is assumed to be fixed by this issue as well. If not, adding it here for consistency.