diff --git a/docs/options.md b/docs/options.md index 4fc6c0340..4d4dfc278 100644 --- a/docs/options.md +++ b/docs/options.md @@ -183,7 +183,7 @@ Valid options: - `"babel"` (via [@babel/parser](https://github.com/babel/babel/tree/master/packages/babel-parser)) _Named `"babylon"` until v1.16.0_ - `"babel-flow"` (Same as `"babel"` but enables Flow parsing explicitly to avoid ambiguity) _First available in v1.16.0_ - `"flow"` (via [flow-parser](https://github.com/facebook/flow/tree/master/src/parser)) -- `"typescript"` (via [typescript-estree](https://github.com/JamesHenry/typescript-estree)) _First available in v1.4.0_ +- `"typescript"` (via [@typescript-eslint/typescript-estree](https://github.com/typescript-eslint/typescript-eslint)) _First available in v1.4.0_ - `"css"` (via [postcss-scss](https://github.com/postcss/postcss-scss) and [postcss-less](https://github.com/shellscape/postcss-less), autodetects which to use) _First available in v1.7.1_ - `"scss"` (same parsers as `"css"`, prefers postcss-scss) _First available in v1.7.1_ - `"less"` (same parsers as `"css"`, prefers postcss-less) _First available in v1.7.1_ diff --git a/package.json b/package.json index 1f842185c..68799af70 100644 --- a/package.json +++ b/package.json @@ -19,6 +19,7 @@ "@babel/parser": "7.2.0", "@glimmer/syntax": "0.30.3", "@iarna/toml": "2.0.0", + "@typescript-eslint/typescript-estree": "1.1.0", "angular-estree-parser": "1.1.5", "angular-html-parser": "1.2.0", "camelcase": "4.1.0", @@ -66,7 +67,6 @@ "semver": "5.4.1", "string-width": "3.0.0", "typescript": "3.2.2", - "typescript-estree": "18.0.0", "unicode-regex": "2.0.0", "unified": "6.1.6", "vnopts": "1.0.2", diff --git a/scripts/build/config.js b/scripts/build/config.js index 9cce659ca..4ddfd79ec 100644 --- a/scripts/build/config.js +++ b/scripts/build/config.js @@ -39,7 +39,7 @@ const parsers = [ input: "src/language-js/parser-typescript.js", target: "universal", replace: { - // node v4 compatibility for typescript-estree + // node v4 compatibility for @typescript-eslint/typescript-estree "(!unique.includes(raw))": "(unique.indexOf(raw) === -1)" } }, diff --git a/src/language-js/needs-parens.js b/src/language-js/needs-parens.js index 47714279d..1ed0f2f33 100644 --- a/src/language-js/needs-parens.js +++ b/src/language-js/needs-parens.js @@ -282,7 +282,6 @@ function needsParens(path, options) { case "ClassExpression": case "ClassDeclaration": - case "TSAbstractClassDeclaration": return name === "superClass" && parent.superClass === node; case "TSTypeAssertion": case "TaggedTemplateExpression": @@ -719,7 +718,6 @@ function isStatement(node) { node.type === "SwitchStatement" || node.type === "ThrowStatement" || node.type === "TryStatement" || - node.type === "TSAbstractClassDeclaration" || node.type === "TSDeclareFunction" || node.type === "TSEnumDeclaration" || node.type === "TSImportEqualsDeclaration" || diff --git a/src/language-js/parser-typescript.js b/src/language-js/parser-typescript.js index efcacf2e7..8f99112f8 100644 --- a/src/language-js/parser-typescript.js +++ b/src/language-js/parser-typescript.js @@ -36,7 +36,7 @@ function parse(text, parsers, opts) { } function tryParseTypeScript(text, jsx) { - const parser = require("typescript-estree"); + const parser = require("@typescript-eslint/typescript-estree"); return parser.parse(text, { loc: true, range: true, diff --git a/src/language-js/printer-estree.js b/src/language-js/printer-estree.js index fcfabfffb..97f34aec8 100644 --- a/src/language-js/printer-estree.js +++ b/src/language-js/printer-estree.js @@ -2346,7 +2346,6 @@ function printPathNoParens(path, options, print, args) { } case "ClassDeclaration": case "ClassExpression": - case "TSAbstractClassDeclaration": if (isNodeStartingWithDeclare(n, options)) { parts.push("declare "); } @@ -4359,7 +4358,6 @@ function printExportDeclaration(path, options, print) { isDefault && (decl.declaration.type !== "ClassDeclaration" && decl.declaration.type !== "FunctionDeclaration" && - decl.declaration.type !== "TSAbstractClassDeclaration" && decl.declaration.type !== "TSInterfaceDeclaration" && decl.declaration.type !== "DeclareClass" && decl.declaration.type !== "DeclareFunction" && @@ -4526,7 +4524,7 @@ function printClass(path, options, print) { const n = path.getValue(); const parts = []; - if (n.type === "TSAbstractClassDeclaration") { + if (n.abstract) { parts.push("abstract "); } diff --git a/yarn.lock b/yarn.lock index a3dae2b40..ff948e520 100644 --- a/yarn.lock +++ b/yarn.lock @@ -674,6 +674,14 @@ version "5.5.0" resolved "https://registry.yarnpkg.com/@types/semver/-/semver-5.5.0.tgz#146c2a29ee7d3bae4bf2fcb274636e264c813c45" +"@typescript-eslint/typescript-estree@1.1.0": + version "1.1.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-1.1.0.tgz#31f19e7197814cb3e609f2822ad6003b6e326470" + integrity sha512-eABnKqJVv0Mm5uYon8Xw61SXldvOhWKDQdoZqsJ/YqEa9XvWV1URXdRvTOW8GLsKo4X3Un7pHKqKZhfbbUEGww== + dependencies: + lodash.unescape "4.0.1" + semver "5.5.0" + abab@^1.0.4: version "1.0.4" resolved "https://registry.yarnpkg.com/abab/-/abab-1.0.4.tgz#5faad9c2c07f60dd76770f71cf025b62a63cfd4e" @@ -5764,14 +5772,6 @@ typedarray@^0.0.6: version "0.0.6" resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" -typescript-estree@18.0.0: - version "18.0.0" - resolved "https://registry.yarnpkg.com/typescript-estree/-/typescript-estree-18.0.0.tgz#a309f6c6502c64d74b3f88c205d871a9af0b1d40" - integrity sha512-HxTWrzFyYOPWA91Ij7xL9mNUVpGTKLH2KiaBn28CMbYgX2zgWdJqU9hO7Are+pAPAqY91NxAYoaAyDDZ3rLj2A== - dependencies: - lodash.unescape "4.0.1" - semver "5.5.0" - typescript@3.2.2: version "3.2.2" resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.2.2.tgz#fe8101c46aa123f8353523ebdcf5730c2ae493e5"