Remove left over eslint 2 estraverse code (babel/babel-eslint#452)
This was missed in babel/babel-eslint#361
This commit is contained in:
parent
1c5400a670
commit
26daac8690
@ -36,17 +36,12 @@ function monkeypatch() {
|
|||||||
|
|
||||||
// get modules relative to what eslint will load
|
// get modules relative to what eslint will load
|
||||||
var eslintMod = createModule(eslintLoc);
|
var eslintMod = createModule(eslintLoc);
|
||||||
// contains all the instances of estraverse so we can modify them if necessary
|
|
||||||
var estraverses = [];
|
|
||||||
// ESLint v1.9.0 uses estraverse directly to work around https://github.com/npm/npm/issues/9663
|
// ESLint v1.9.0 uses estraverse directly to work around https://github.com/npm/npm/issues/9663
|
||||||
var estraverseOfEslint = eslintMod.require("estraverse");
|
var estraverse = eslintMod.require("estraverse");
|
||||||
estraverses.push(estraverseOfEslint);
|
|
||||||
Object.assign(estraverseOfEslint.VisitorKeys, t.VISITOR_KEYS);
|
|
||||||
|
|
||||||
estraverses.forEach((estraverse) => {
|
Object.assign(estraverse.VisitorKeys, t.VISITOR_KEYS);
|
||||||
estraverse.VisitorKeys.MethodDefinition.push("decorators");
|
estraverse.VisitorKeys.MethodDefinition.push("decorators");
|
||||||
estraverse.VisitorKeys.Property.push("decorators");
|
estraverse.VisitorKeys.Property.push("decorators");
|
||||||
});
|
|
||||||
|
|
||||||
// monkeypatch escope
|
// monkeypatch escope
|
||||||
var escopeLoc = Module._resolveFilename("escope", eslintMod);
|
var escopeLoc = Module._resolveFilename("escope", eslintMod);
|
||||||
@ -275,16 +270,12 @@ function monkeypatch() {
|
|||||||
}
|
}
|
||||||
// set ArrayPattern/ObjectPattern visitor keys back to their original. otherwise
|
// set ArrayPattern/ObjectPattern visitor keys back to their original. otherwise
|
||||||
// escope will traverse into them and include the identifiers within as declarations
|
// escope will traverse into them and include the identifiers within as declarations
|
||||||
estraverses.forEach((estraverse) => {
|
|
||||||
estraverse.VisitorKeys.ObjectPattern = ["properties"];
|
estraverse.VisitorKeys.ObjectPattern = ["properties"];
|
||||||
estraverse.VisitorKeys.ArrayPattern = ["elements"];
|
estraverse.VisitorKeys.ArrayPattern = ["elements"];
|
||||||
});
|
|
||||||
visitFunction.call(this, node);
|
visitFunction.call(this, node);
|
||||||
// set them back to normal...
|
// set them back to normal...
|
||||||
estraverses.forEach((estraverse) => {
|
|
||||||
estraverse.VisitorKeys.ObjectPattern = t.VISITOR_KEYS.ObjectPattern;
|
estraverse.VisitorKeys.ObjectPattern = t.VISITOR_KEYS.ObjectPattern;
|
||||||
estraverse.VisitorKeys.ArrayPattern = t.VISITOR_KEYS.ArrayPattern;
|
estraverse.VisitorKeys.ArrayPattern = t.VISITOR_KEYS.ArrayPattern;
|
||||||
});
|
|
||||||
if (typeParamScope) {
|
if (typeParamScope) {
|
||||||
this.close(node);
|
this.close(node);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user