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

Commit

Permalink
Fix: ignore eval (fixes #560) (#561)
Browse files Browse the repository at this point in the history
  • Loading branch information
mysticatea committed 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
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
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.