From 8c45795831092a3fe090790330e790fb59831e5d Mon Sep 17 00:00:00 2001 From: Toru Nagashima Date: Tue, 10 Nov 2015 10:17:12 +0900 Subject: [PATCH] fix for npm@3 and eslint@1.9 --- index.js | 6 ++++++ package.json | 2 +- test/non-regression.js | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index 3cf0b653..4f72a115 100644 --- a/index.js +++ b/index.js @@ -55,6 +55,12 @@ function monkeypatch() { var estraverseFb = eslintMod.require("estraverse-fb"); assign(estraverseFb.VisitorKeys, t.VISITOR_KEYS); + // ESLint v1.9.0 uses estraverse directly to work around https://github.com/npm/npm/issues/9663 + var estraverseOfEslint = eslintMod.require("estraverse"); + if (estraverseOfEslint !== estraverseFb) { + assign(estraverseOfEslint.VisitorKeys, t.VISITOR_KEYS); + } + // monkeypatch escope var escope = require(escopeLoc); var analyze = escope.analyze; diff --git a/package.json b/package.json index cd3c43db..dc331920 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,7 @@ }, "homepage": "https://github.com/babel/babel-eslint", "devDependencies": { - "eslint": "^1.8.0", + "eslint": "^1.9.0", "espree": "^2.2.5", "mocha": "^2.3.3" } diff --git a/test/non-regression.js b/test/non-regression.js index 3e749b6f..3022560e 100644 --- a/test/non-regression.js +++ b/test/non-regression.js @@ -1365,7 +1365,7 @@ describe("verify", function () { "var x = 1;" ].join("\n"), { "no-use-before-define": 1 }, - [ "1:13 x was used before it was defined no-use-before-define" ] + [ "1:13 \"x\" was used before it was defined no-use-before-define" ] ) }); });