From 170033f3f82b72b18352a6bb2bc824c0ff471def Mon Sep 17 00:00:00 2001 From: fisker Cheung Date: Sun, 2 Aug 2020 07:03:20 +0800 Subject: [PATCH] Update `@typescript-eslint/typescript-estree` to v3.7.1 (#8805) --- changelog_unreleased/typescript/pr-8805.md | 15 ++++++++++ package.json | 2 +- .../__snapshots__/jsfmt.spec.js.snap | 23 +++++++++++++++ tests/typescript/catch-clause/jsfmt.spec.js | 1 + .../catch-clause/type-annotation.ts | 5 ++++ yarn.lock | 28 +++++++++---------- 6 files changed, 59 insertions(+), 15 deletions(-) create mode 100644 changelog_unreleased/typescript/pr-8805.md create mode 100644 tests/typescript/catch-clause/__snapshots__/jsfmt.spec.js.snap create mode 100644 tests/typescript/catch-clause/jsfmt.spec.js create mode 100644 tests/typescript/catch-clause/type-annotation.ts diff --git a/changelog_unreleased/typescript/pr-8805.md b/changelog_unreleased/typescript/pr-8805.md new file mode 100644 index 000000000..5c5784b48 --- /dev/null +++ b/changelog_unreleased/typescript/pr-8805.md @@ -0,0 +1,15 @@ +#### Support type annotations on catch clauses ([#8805](https://github.com/prettier/prettier/pull/8805) by [@fisker](https://github.com/fisker)) + + +```ts +// Input +try {} catch (e: any) {} + +// Prettier stable +try { +} catch (e) {} + +// Prettier master +try { +} catch (e: any) {} +``` diff --git a/package.json b/package.json index f7549c399..53788bb30 100644 --- a/package.json +++ b/package.json @@ -25,7 +25,7 @@ "@babel/parser": "7.10.5", "@glimmer/syntax": "0.55.2", "@iarna/toml": "2.2.5", - "@typescript-eslint/typescript-estree": "3.6.1", + "@typescript-eslint/typescript-estree": "3.7.1", "angular-estree-parser": "2.1.0", "angular-html-parser": "1.7.1", "camelcase": "6.0.0", diff --git a/tests/typescript/catch-clause/__snapshots__/jsfmt.spec.js.snap b/tests/typescript/catch-clause/__snapshots__/jsfmt.spec.js.snap new file mode 100644 index 000000000..c5c77b9c2 --- /dev/null +++ b/tests/typescript/catch-clause/__snapshots__/jsfmt.spec.js.snap @@ -0,0 +1,23 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`type-annotation.ts format 1`] = ` +====================================options===================================== +parsers: ["typescript"] +printWidth: 80 + | printWidth +=====================================input====================================== +try {} catch (e: any) +{} + +try {} +catch (e: unknown) {} + +=====================================output===================================== +try { +} catch (e: any) {} + +try { +} catch (e: unknown) {} + +================================================================================ +`; diff --git a/tests/typescript/catch-clause/jsfmt.spec.js b/tests/typescript/catch-clause/jsfmt.spec.js new file mode 100644 index 000000000..7f894a14e --- /dev/null +++ b/tests/typescript/catch-clause/jsfmt.spec.js @@ -0,0 +1 @@ +run_spec(__dirname, ["typescript"], { disableBabelTS: ["type-annotation.ts"] }); diff --git a/tests/typescript/catch-clause/type-annotation.ts b/tests/typescript/catch-clause/type-annotation.ts new file mode 100644 index 000000000..560df2ff8 --- /dev/null +++ b/tests/typescript/catch-clause/type-annotation.ts @@ -0,0 +1,5 @@ +try {} catch (e: any) +{} + +try {} +catch (e: unknown) {} diff --git a/yarn.lock b/yarn.lock index e0e20fec5..29d2a24fe 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1382,10 +1382,10 @@ eslint-scope "^5.0.0" eslint-utils "^2.0.0" -"@typescript-eslint/types@3.6.1": - version "3.6.1" - resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-3.6.1.tgz#87600fe79a1874235d3cc1cf5c7e1a12eea69eee" - integrity sha512-NPxd5yXG63gx57WDTW1rp0cF3XlNuuFFB5G+Kc48zZ+51ZnQn9yjDEsjTPQ+aWM+V+Z0I4kuTFKjKvgcT1F7xQ== +"@typescript-eslint/types@3.7.1": + version "3.7.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-3.7.1.tgz#90375606b2fd73c1224fe9e397ee151e28fa1e0c" + integrity sha512-PZe8twm5Z4b61jt7GAQDor6KiMhgPgf4XmUb9zdrwTbgtC/Sj29gXP1dws9yEn4+aJeyXrjsD9XN7AWFhmnUfg== "@typescript-eslint/typescript-estree@2.34.0": version "2.34.0" @@ -1400,13 +1400,13 @@ semver "^7.3.2" tsutils "^3.17.1" -"@typescript-eslint/typescript-estree@3.6.1": - version "3.6.1" - resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-3.6.1.tgz#a5c91fcc5497cce7922ff86bc37d5e5891dcdefa" - integrity sha512-G4XRe/ZbCZkL1fy09DPN3U0mR6SayIv1zSeBNquRFRk7CnVLgkC2ZPj8llEMJg5Y8dJ3T76SvTGtceytniaztQ== +"@typescript-eslint/typescript-estree@3.7.1": + version "3.7.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-3.7.1.tgz#ce1ffbd0fa53f34d4ce851a7a364e392432f6eb3" + integrity sha512-m97vNZkI08dunYOr2lVZOHoyfpqRs0KDpd6qkGaIcLGhQ2WPtgHOd/eVbsJZ0VYCQvupKrObAGTOvk3tfpybYA== dependencies: - "@typescript-eslint/types" "3.6.1" - "@typescript-eslint/visitor-keys" "3.6.1" + "@typescript-eslint/types" "3.7.1" + "@typescript-eslint/visitor-keys" "3.7.1" debug "^4.1.1" glob "^7.1.6" is-glob "^4.0.1" @@ -1414,10 +1414,10 @@ semver "^7.3.2" tsutils "^3.17.1" -"@typescript-eslint/visitor-keys@3.6.1": - version "3.6.1" - resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-3.6.1.tgz#5c57a7772f4dd623cfeacc219303e7d46f963b37" - integrity sha512-qC8Olwz5ZyMTZrh4Wl3K4U6tfms0R/mzU4/5W3XeUZptVraGVmbptJbn6h2Ey6Rb3hOs3zWoAUebZk8t47KGiQ== +"@typescript-eslint/visitor-keys@3.7.1": + version "3.7.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-3.7.1.tgz#b90191e74efdee656be8c5a30f428ed16dda46d1" + integrity sha512-xn22sQbEya+Utj2IqJHGLA3i1jDzR43RzWupxojbSWnj3nnPLavaQmWe5utw03CwYao3r00qzXfgJMGNkrzrAA== dependencies: eslint-visitor-keys "^1.1.0"