-
-
Notifications
You must be signed in to change notification settings - Fork 209
Fix escope to take sourceType and ecmaVersion from options #288
Conversation
Nice! Thanks @danez |
); | ||
}); | ||
|
||
it("no-implicit-globals in module", function () { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess we should add a test for when the parserOptions aren't specified?
I removed the defaulting to After fixing that now only one test fails, but I don't have time right now to investigate. Seems there is still a difference between setting |
Looks like you're referring to the "no-use-before-define #192" test. It looks like @hzoo suggested modules must be used in this case. |
escope was hardcoded to sourcetype: "module" and ecmaVersion: "6" This changes it to take the configuration from the eslint options and still defaulting to "module" and "6". This is done by having to global variables, as monkeypatch is only triggered once. To fix scoping issues, the same logic as in eslint is applied. It disables the nodejs scope if the sourceType is module.
Ok I finally had time to look at this and figured out what the problem was with the "no-use-before-define" rule test. Now the nodejsScope is set to false if sourceType is module. Like eslint is doing that: |
This looks good to me! |
@hzoo Do you have time to look at this? |
Friendly bump 😄 |
Sorry all - busy and maybe didn't want to check all of this 😄 . |
@hzoo ❤️ |
…el-eslint#288) escope was hardcoded to sourcetype: "module" and ecmaVersion: "6" This changes it to take the configuration from the eslint options and still defaulting to "module" and "6". This is done by having to global variables, as monkeypatch is only triggered once. To fix scoping issues, the same logic as in eslint is applied. It disables the nodejs scope if the sourceType is module.
escope was hardcoded to sourcetype: "module" and ecmaVersion: "6"
This changes it to take the configuration from the eslint options and still
defaulting to "module" and "6".
This is done by having the variables in the upper scope, as monkeypatch is only triggered once and would therefore stick to the options that are supplied the first time. But the options can change as in our tests or different eslintrc files in different directories.
Fixes #287 and #217 (217 was failing without the fix in script mode)