Skip to content

Commit

Permalink
Fix flow types.
Browse files Browse the repository at this point in the history
This is a work-around for babel#66, extending the monkeypatch to escope to ensure it does not traverse into TypeAlias nodes and incorrectly infer a reference.
  • Loading branch information
leebyron committed Apr 8, 2015
1 parent e23b152 commit aab896f
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,13 @@ function monkeypatch() {
escope.analyze = function (ast, opts) {
opts.ecmaVersion = 6;
opts.sourceType = "module";
return analyze.call(this, ast, opts)
// Don't visit TypeAlias when analyzing scope, but retain them for other
// eslint rules.
var TypeAliasKeys = estraverse.VisitorKeys.TypeAlias;
estraverse.VisitorKeys.TypeAlias = [];
var results = analyze.call(this, ast, opts);
estraverse.VisitorKeys.TypeAlias = TypeAliasKeys;
return results;
};
}

Expand Down

0 comments on commit aab896f

Please sign in to comment.