From 5a828bedd19bcf60a75e4c1e8444e6bf2993fe3c Mon Sep 17 00:00:00 2001 From: Christopher Chedeau Date: Sun, 28 May 2017 16:05:07 -0700 Subject: [PATCH] Update eslint-typescript again (#1791) Now fixes more issues ;) --- package.json | 2 +- src/printer.js | 6 ++++++ tests/typescript_class/__snapshots__/jsfmt.spec.js.snap | 8 ++++++++ tests/typescript_class/methods.ts | 4 ++++ yarn.lock | 7 +++++++ 5 files changed, 26 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 4b5c2bbb..27d52de8 100644 --- a/package.json +++ b/package.json @@ -42,7 +42,7 @@ "rollup-plugin-node-globals": "1.1.0", "rollup-plugin-node-resolve": "2.0.0", "typescript": "2.3.2", - "typescript-eslint-parser": "git://github.com/eslint/typescript-eslint-parser.git#2d09fb183e36a3b4089509c67cd256cd5f8871b0" + "typescript-eslint-parser": "git://github.com/eslint/typescript-eslint-parser.git#87445776fce9dbc67139890b18143e767ab19c7d" }, "scripts": { "test": "jest", diff --git a/src/printer.js b/src/printer.js index 327e205f..b1064131 100644 --- a/src/printer.js +++ b/src/printer.js @@ -2384,7 +2384,13 @@ function genericPrintNoParens(path, options, print, args) { return concat(parts); case "TSMethodSignature": parts.push( + n.accessibility ? concat([n.accessibility, " "]) : "", + n.export ? "export " : "", + n.static ? "static " : "", + n.readonly ? "readonly " : "", + n.computed ? "[" : "", path.call(print, "key"), + n.computed ? "]" : "", n.optional ? "?" : "", printFunctionTypeParameters(path, options, print), printFunctionParams(path, print, options) diff --git a/tests/typescript_class/__snapshots__/jsfmt.spec.js.snap b/tests/typescript_class/__snapshots__/jsfmt.spec.js.snap index a6913404..fd701b7b 100644 --- a/tests/typescript_class/__snapshots__/jsfmt.spec.js.snap +++ b/tests/typescript_class/__snapshots__/jsfmt.spec.js.snap @@ -47,11 +47,19 @@ exports[`methods.ts 1`] = ` class X { optionalMethod?() {} } + +interface Iterable { + export [Symbol.iterator](): Iterator; +} ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ class X { optionalMethod?() {} } +interface Iterable { + export [Symbol.iterator](): Iterator; +} + `; exports[`optional.ts 1`] = ` diff --git a/tests/typescript_class/methods.ts b/tests/typescript_class/methods.ts index a1ced754..7bdcdca8 100644 --- a/tests/typescript_class/methods.ts +++ b/tests/typescript_class/methods.ts @@ -1,3 +1,7 @@ class X { optionalMethod?() {} } + +interface Iterable { + export [Symbol.iterator](): Iterator; +} diff --git a/yarn.lock b/yarn.lock index 2729fd10..25b8313a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2821,6 +2821,13 @@ typedarray@^0.0.6: lodash.unescape "4.0.1" semver "5.3.0" +"typescript-eslint-parser@git://github.com/eslint/typescript-eslint-parser.git#87445776fce9dbc67139890b18143e767ab19c7d": + version "3.0.0" + resolved "git://github.com/eslint/typescript-eslint-parser.git#87445776fce9dbc67139890b18143e767ab19c7d" + dependencies: + lodash.unescape "4.0.1" + semver "5.3.0" + typescript@2.3.2: version "2.3.2" resolved "https://registry.yarnpkg.com/typescript/-/typescript-2.3.2.tgz#f0f045e196f69a72f06b25fd3bd39d01c3ce9984"