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
Overriding Promise does not trigger errors #3971
Comments
Thanks for the issue! If you're reporting a bug, please be sure to include:
Requesting a new rule? Please see Proposing a New Rule for instructions. |
I think this is the rule you are looking for: http://eslint.org/docs/rules/no-native-reassign |
Damn, have been looking through the docs forever. Looks like only no-redeclare with So thanks for pointing me in the right direction! My problem is solved for now, but this might still be a bug for |
I will furthur investigate this. |
I think this is correct behavior for all rules involved. This should not be flagged by |
@ilyavolodin Makes sense. Trying to |
Alright thanks everyone for the discussion. |
That's not true. Top-level lexical declarations in modules shadow bindings in the global scope (see ES2015 §15.2.1.16.4 step 6). |
@michaelficarra I was thinking about it as I was writing my response. However, those are mechanics of the language itself. I'm not really sure it would be obvious to anyone outside of a few people who really know how global scope works in modules. And since this error is correctly reported by |
Remember, node environment adds an extra scope, so |
In that case, should |
Correct. In the node environment, it's not a redeclaration, it's shadow. |
I will try to fix this.
|
…t#3971) When there is a special scope (`globalReturn` or `modules`), no longer `no-redeclare` reports redeclarations of built-in globals. And when that, `no-shadow` reports shadowing of built-in globals.
I don't think this is breaking, it's just a bug. |
What version are you using?
v1.5.1
What did you do?
We recently upgraded to Node 4.0.0 which includes Promises by default. As we have been using Bluebird Promises before, we want to remove this dependency where possible, and rename the variables we assign Bluebird to (e.g. to something like
BBPromise
to easily see the difference with native Promises).JSHint always reported about the
Redefinition of Promise
when usingvar Promise = require("bluebird");
However, I can't seem to get the same from ESLint.The following shows the problem:
What happened?
Running ESLint on the piece of code returns without errors or warnings. Explicitly adding
/*global Promise:false*/
does not change the results.What did you expect to happen?
I expect ESLint to return an error about the fact that I'm redefining a global variable.
The text was updated successfully, but these errors were encountered: