-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
Proposal: no-redeclare reports /*globals foo*/ comments if it's redeclaration #11370
Comments
I added |
Could you elaborate on what changes to core would be needed to implement this? |
Sure. The change will happen in Line 72 in 0a3c3ff
It needs to keep all locations rather than overriding. |
Thanks for elaborating. I think this sounds like a good idea overall, but it would be useful to have a more concrete proposal for what the breaking changes are. (For example, would there be two variables with the same name in the global Before 0a3c3ff, I think After this change, would the following create a {
"globals": {
"Foo": "writable"
}
} // Change `Foo` from "writable" to "readable"
/* global Foo */ |
Thank you for the feedback!
This proposal will do:
My preference is that
My preference is that const Foo = 0
let Foo = 1 // 'Foo' is defined already. |
Changing However, would we want to name the property |
Sounds good to me. |
We should do an RFC for this. |
This change was accepted in today's TSC meeting, but there was agreement that an RFC would be useful to decide on the precise changes to core. |
- Implement eslint/rfcs#17 - Fixes #11370 - Remvoes the access to parserOptions from no-redeclare rule - Adds several tests for lexical bindings to no-redeclare rule
What rule do you want to change?
Does this change cause the rule to produce more or fewer warnings?
How will the change be implemented? (New option, new default behavior, etc.)?
Please provide some example code that this change will affect:
config:
code:
/*globals window */
What does the rule currently do for this code?
What will the rule do after it's changed?
window
in/*globals*/
comment because it's declared already.For a reference, no-unused-vars rule reports unused variables that
/*globals*/
comment defined. For example:Therefore, this change makes consistent between no-unused-vars rule and no-redeclare rule.
Are you willing to submit a pull request to implement this change?
Yes, I will do.
The text was updated successfully, but these errors were encountered: