From f27f6c525bf8737f174348c162c12143daff21cb Mon Sep 17 00:00:00 2001 From: Ika Date: Tue, 5 Jun 2018 00:08:24 +0800 Subject: [PATCH] fix(typescript): preserve decorator on interface (#4632) --- package.json | 2 +- .../__snapshots__/jsfmt.spec.js.snap | 17 +++++++++++++++++ tests/typescript_decorators/interface.ts | 6 ++++++ yarn.lock | 6 +++--- 4 files changed, 27 insertions(+), 4 deletions(-) create mode 100644 tests/typescript_decorators/interface.ts diff --git a/package.json b/package.json index 199b5ec3..1fb75c10 100644 --- a/package.json +++ b/package.json @@ -55,7 +55,7 @@ "semver": "5.4.1", "string-width": "2.1.1", "typescript": "2.9.0-dev.20180421", - "typescript-eslint-parser": "eslint/typescript-eslint-parser#2960b002746c01fb9cb15bb5f4c1e7e925c6519a", + "typescript-eslint-parser": "16.0.0", "unicode-regex": "1.0.1", "unified": "6.1.6" }, diff --git a/tests/typescript_decorators/__snapshots__/jsfmt.spec.js.snap b/tests/typescript_decorators/__snapshots__/jsfmt.spec.js.snap index 77e1fb6d..bf859531 100644 --- a/tests/typescript_decorators/__snapshots__/jsfmt.spec.js.snap +++ b/tests/typescript_decorators/__snapshots__/jsfmt.spec.js.snap @@ -247,3 +247,20 @@ class MyContainerComponent { } `; + +exports[`interface.ts 1`] = ` +// invalid place but shouldn't be removed + +@hello() +interface MyInterface { + id: string; +} +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// invalid place but shouldn't be removed + +@hello() +interface MyInterface { + id: string; +} + +`; diff --git a/tests/typescript_decorators/interface.ts b/tests/typescript_decorators/interface.ts new file mode 100644 index 00000000..de7bb11c --- /dev/null +++ b/tests/typescript_decorators/interface.ts @@ -0,0 +1,6 @@ +// invalid place but shouldn't be removed + +@hello() +interface MyInterface { + id: string; +} diff --git a/yarn.lock b/yarn.lock index d1c7a6d7..3f0af11d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5556,9 +5556,9 @@ typedarray@^0.0.6: version "0.0.6" resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" -typescript-eslint-parser@eslint/typescript-eslint-parser#2960b002746c01fb9cb15bb5f4c1e7e925c6519a: - version "14.0.0" - resolved "https://codeload.github.com/eslint/typescript-eslint-parser/tar.gz/2960b002746c01fb9cb15bb5f4c1e7e925c6519a" +typescript-eslint-parser@16.0.0: + version "16.0.0" + resolved "https://registry.yarnpkg.com/typescript-eslint-parser/-/typescript-eslint-parser-16.0.0.tgz#14a9ab75932b15af919602faef553c6f0487f352" dependencies: lodash.unescape "4.0.1" semver "5.5.0"