Update tsep and account for AST differences (#2647)

master
James Henry 2017-08-21 20:27:35 +01:00 committed by Christopher Chedeau
parent b77b1c82a7
commit 23e0e90779
3 changed files with 12 additions and 9 deletions

View File

@ -35,7 +35,7 @@
"postcss-values-parser": "git://github.com/shellscape/postcss-values-parser.git#5e351360479116f3fe309602cdd15b0a233bc29f",
"strip-bom": "3.0.0",
"typescript": "2.5.0-dev.20170617",
"typescript-eslint-parser": "git://github.com/eslint/typescript-eslint-parser.git#65b019ba9a10475af30e664ce38e550c21acdedd"
"typescript-eslint-parser": "git://github.com/eslint/typescript-eslint-parser.git#01c34f44e7bb3b8a1ec3d28433a6e0c9b2901d3c"
},
"devDependencies": {
"babel-cli": "6.24.1",

View File

@ -612,7 +612,7 @@ function genericPrintNoParens(path, options, print, args) {
}
return path.call(print, "id");
case "TSExportAssigment":
case "TSExportAssignment":
return concat(["export = ", path.call(print, "expression"), semi]);
case "ExportDefaultDeclaration":
case "ExportNamedDeclaration":
@ -2624,22 +2624,25 @@ function genericPrintNoParens(path, options, print, args) {
return concat(["require(", path.call(print, "expression"), ")"]);
case "TSModuleDeclaration": {
const parent = path.getParentNode();
const isExternalModule = isLiteral(n.name);
const isExternalModule = isLiteral(n.id);
const parentIsDeclaration = parent.type === "TSModuleDeclaration";
const bodyIsDeclaration = n.body && n.body.type === "TSModuleDeclaration";
if (parentIsDeclaration) {
parts.push(".");
} else {
if (n.declare === true) {
parts.push("declare ");
}
parts.push(printTypeScriptModifiers(path, options, print));
// Global declaration looks like this:
// (declare)? global { ... }
const isGlobalDeclaration =
n.name.type === "Identifier" &&
n.name.name === "global" &&
n.id.type === "Identifier" &&
n.id.name === "global" &&
!/namespace|module/.test(
options.originalText.slice(util.locStart(n), util.locStart(n.name))
options.originalText.slice(util.locStart(n), util.locStart(n.id))
);
if (!isGlobalDeclaration) {
@ -2647,7 +2650,7 @@ function genericPrintNoParens(path, options, print, args) {
}
}
parts.push(path.call(print, "name"));
parts.push(path.call(print, "id"));
if (bodyIsDeclaration) {
parts.push(path.call(print, "body"));

View File

@ -3808,9 +3808,9 @@ typedarray@^0.0.6:
version "0.0.6"
resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777"
"typescript-eslint-parser@git://github.com/eslint/typescript-eslint-parser.git#65b019ba9a10475af30e664ce38e550c21acdedd":
"typescript-eslint-parser@git://github.com/eslint/typescript-eslint-parser.git#01c34f44e7bb3b8a1ec3d28433a6e0c9b2901d3c":
version "6.0.1"
resolved "git://github.com/eslint/typescript-eslint-parser.git#65b019ba9a10475af30e664ce38e550c21acdedd"
resolved "git://github.com/eslint/typescript-eslint-parser.git#01c34f44e7bb3b8a1ec3d28433a6e0c9b2901d3c"
dependencies:
lodash.unescape "4.0.1"
semver "5.3.0"