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
"use strict"
in ES3
#86
Comments
It seems like there are multiple areas trying to track strict mode. isStrictModeSupported: eslint-scope/lib/scope-manager.js Line 80 in d756f1e
useDirective: eslint-scope/lib/scope-manager.js Line 56 in d756f1e
isStrictScope: Line 45 in 22a55c0
Can you narrow down where the problem is coming from? I’m guessing from useDirective, which doesn’t seem necessary as a separate option from ecmaVersion. |
(by "configuration option" I mean an option passed to It doesn't control whether or not When the option is Lines 86 to 97 in ceb8bdd
That's probably an alternative AST spec that was actual when When the option is Lines 97 to 119 in ceb8bdd
That's per the ESTree spec. ESLint doesn't set the The conclusion is that it doesn't seem that Off-topic, we could consider dropping the |
eslint-scope/lib/referencer.js Lines 409 to 425 in ceb8bdd
I believe this issue will be fixed by setting Lines 262 to 266 in ceb8bdd
|
PR #87 |
Per eslint/eslint#15456,
"use strict"
directives should not apply in ES3.eslint-scope currently does apply
"use strict"
directives in ES3 mode. Given the above, that behavior looks like a bug.This is observable with
no-invalid-this
rule, which usesScope#isStrict
.This rule aims to report undefined
this
. Lowercase functions are assumed to be called withoutthis
. If the function is strict code, thenthis
is undefined and it should be reported. If the function is non-strict code, thenthis
refers to the global object and therefore it shouldn't be reported.Online Demo with ES3 - the rule reports error, which seems wrong because this isn't strict code in ES3.
The text was updated successfully, but these errors were encountered: