Skip to content
This repository has been archived by the owner on Aug 18, 2021. It is now read-only.

Fix: use eslint-scope instead of escope if present #461

Merged
merged 1 commit into from
Apr 12, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,17 @@ function getModules() {
eslintMod.filename = eslintLoc;
eslintMod.paths = Module._nodeModulePaths(path.dirname(eslintLoc));

var Definition = eslintMod.require("escope/lib/definition").Definition;
var escope = eslintMod.require("escope");
try {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a blocker, but my preference would be to not rely on var hoisting here, but it looks like that's the style that was used here previously. babel-eslint actually supports Node >=4, so we can update some of this at some point!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, my personal preference here would also be to avoid the hoisting, but I tried to stick to the style from the file in this case!

var escope = eslintMod.require("eslint-scope");
var Definition = eslintMod.require("eslint-scope/lib/definition").Definition;
var referencer = eslintMod.require("eslint-scope/lib/referencer");
} catch (err) {
escope = eslintMod.require("escope");
Definition = eslintMod.require("escope/lib/definition").Definition;
referencer = eslintMod.require("escope/lib/referencer");
}

var estraverse = eslintMod.require("estraverse");
var referencer = eslintMod.require("escope/lib/referencer");

if (referencer.__esModule) referencer = referencer.default;

Expand Down