Skip to content

Commit

Permalink
Fix: ignore eval (fixes babel#560) (babel#561)
Browse files Browse the repository at this point in the history
  • Loading branch information
mysticatea authored Dec 26, 2017
1 parent d84b236 commit bf9092a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/analyze-scope.js
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,7 @@ class Referencer extends OriginalReferencer {

module.exports = function(ast, parserOptions) {
const options = {
ignoreEval: true,
optimistic: false,
directive: false,
nodejsScope:
Expand Down
12 changes: 12 additions & 0 deletions test/non-regression.js
Original file line number Diff line number Diff line change
Expand Up @@ -1874,4 +1874,16 @@ describe("verify", () => {
[]
);
});

it("ignore eval in scope analysis", () => {
verifyAndAssertMessages(
unpad(`
const a = 1;
console.log(a);
eval('');
`),
{ "no-unused-vars": 1, "no-undef": 1 },
[]
);
});
});

0 comments on commit bf9092a

Please sign in to comment.