-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
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
no-alert and others #1105
Comments
Is there a reason you don't turn off |
yes I don't want somebody uses window.alert, as it is supposed by this linter ... alert in my implementation is a custom ui. |
I'm not sure this is easily achievable. Basically we'd need to keep track of |
Personally I think this is a valid application of the rule - that is, it should flag this case. Shadowing 'alert' means that if you copy-and-paste any of the code, or otherwise exit the shadowed scope, you suddenly have a wild alert statement in your code. It's a visible bug waiting to happen. You should just name the variable something else that doesn't shadow a dangerous global. |
no its ok to copy paste it. Your new location will do the same check and if its not declared, linter will warn. If you copy that to an application which isn't using linter -> different issue. |
I agree with @kof. I think it's reasonable to expect As for implementation, this can be easily done by either making use of escope (the reference won't have a |
Is there a way to explicitly turn off global Because this is much better solution than tracking where |
You'd need to disable the browser environment to do that. There's no way to undefine a global one it's been defined. |
Update: allow shadowed references in no-alert (fixes #1105)
They should be smart enough to recognize that I am not calling window.alert. I have a component named alert and its declared like this
var alert = require('components/notification/alert')
Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.
The text was updated successfully, but these errors were encountered: