Repository: prettier/prettier (JavaScript)

Issue:
Typescript Issue: Template string based decorators are wrapped with parentheses 
I've developed an experimental project called [Dogma](https://www.npmjs.com/package/@dogmajs/core) that implements a template string based decorator to annotate retrievable comments for properties. 

**Prettier 2.4.1**
https://prettier.io/playground/#N4Igxg9gdgLgprEAucAbAhgZ0wAgCpyYw7AA6UOOAAgCIQDmAtugHSSOMLEAGAsgJ452nWN3KV4ADxhIcRAE4BLKPXIBfEABoQEAA4xF0TMlDp58iAHcACmYTGU6VJfT9j2gEbz0YANZwYAGV0TgAZZThkADMnTDhPbz8AwN0fZXpkGHkAV3iQOEYPOAATYpLQ9BVs9Ho4ADEIeWYYAxVkEHRsmAgtEAALGEZUAHU+xXhMVLA4QPtxxQA3cf52sGxe5Tj5GGtvJnRo2LyAK0xJQPTUOABFbIh4Q9Q47VT5LfaYfl1CMCV9Xt0Slgw0UxRgfWQAA4AAwvCxxYbeXTtQGEODyBaRbQARzu8F2egcHUwAFooHASiVevI4LjFDTdjVmI9niA4oxFJkcnlMJcbnjIkgYk88jB0B4QWCIUgAEzaLLoRSodIAYQgHAOKEIAFZetk4nhxQ5hayFrkAJJQMqwQK-RT6ACCVsCnyuLLgajUQA

**Input:**

```typescript
class Test {
  @Dogma.comment `My comment`
  text: string
}
```

**Output:**

```typescript
class Test {
  @(Dogma.comment`My comment`)
  text: string;
}
```

Typescript parser, different from Babel, doesn't require that template string based decorators have parentheses, but prettier doesn't comprehend that by adding parentheses that makes the decoration uglier and defeats the purpose of having the decorator as template string based.





Hints:

Patch:
diff --git a/src/language-js/needs-parens.js b/src/language-js/needs-parens.js
--- a/src/language-js/needs-parens.js
+++ b/src/language-js/needs-parens.js
@@ -140,6 +140,10 @@ function needsParens(path, options) {
               break;
             case "Identifier":
               return false;
+            case "TaggedTemplateExpression":
+              // babel-parser cannot parse
+              //   @foo`bar`
+              return options.parser !== "typescript";
             default:
               return true;
           }


Test patch:
diff --git a/tests/format/misc/errors/babel-ts/__snapshots__/jsfmt.spec.js.snap b/tests/format/misc/errors/babel-ts/__snapshots__/jsfmt.spec.js.snap
--- a/tests/format/misc/errors/babel-ts/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/format/misc/errors/babel-ts/__snapshots__/jsfmt.spec.js.snap
@@ -41,6 +41,16 @@ exports[`multiline-declaration-type.ts [babel-ts] format 1`] = `
   3 |"
 `;
 
+exports[`parenthesized-decorators-tagged-template.ts [babel-ts] format 1`] = `
+"Unexpected token (2:7)
+  1 | class Test {
+> 2 |   @foo\`bar\`
+    |       ^
+  3 |   text: string = \\"text\\"
+  4 | }
+  5 |"
+`;
+
 exports[`type-annotation-expr-statement.ts [babel-ts] format 1`] = `
 "Did not expect a type annotation here. (1:3)
 > 1 | (a: T);
diff --git a/tests/format/misc/errors/babel-ts/parenthesized-decorators-tagged-template.ts b/tests/format/misc/errors/babel-ts/parenthesized-decorators-tagged-template.ts
new file mode 100644
--- /dev/null
+++ b/tests/format/misc/errors/babel-ts/parenthesized-decorators-tagged-template.ts
@@ -0,0 +1,4 @@
+class Test {
+  @foo`bar`
+  text: string = "text"
+}
diff --git a/tests/format/misc/typescript-babel-only/__snapshots__/jsfmt.spec.js.snap b/tests/format/misc/typescript-babel-only/__snapshots__/jsfmt.spec.js.snap
--- a/tests/format/misc/typescript-babel-only/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/format/misc/typescript-babel-only/__snapshots__/jsfmt.spec.js.snap
@@ -60,6 +60,26 @@ class Bar {
 ================================================================================
 `;
 
+exports[`parenthesized-decorators-tagged-template.ts format 1`] = `
+====================================options=====================================
+parsers: ["babel-ts"]
+printWidth: 80
+                                                                                | printWidth
+=====================================input======================================
+class Test {
+  @(foo\`bar\`)
+  text: string = "text"
+}
+
+=====================================output=====================================
+class Test {
+  @(foo\`bar\`)
+  text: string = "text";
+}
+
+================================================================================
+`;
+
 exports[`prettier-ignore-nested-unions.ts format 1`] = `
 ====================================options=====================================
 parsers: ["babel-ts"]
diff --git a/tests/format/misc/typescript-babel-only/parenthesized-decorators-tagged-template.ts b/tests/format/misc/typescript-babel-only/parenthesized-decorators-tagged-template.ts
new file mode 100644
--- /dev/null
+++ b/tests/format/misc/typescript-babel-only/parenthesized-decorators-tagged-template.ts
@@ -0,0 +1,4 @@
+class Test {
+  @(foo`bar`)
+  text: string = "text"
+}
diff --git a/tests/format/misc/typescript-only/__snapshots__/jsfmt.spec.js.snap b/tests/format/misc/typescript-only/__snapshots__/jsfmt.spec.js.snap
--- a/tests/format/misc/typescript-only/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/format/misc/typescript-only/__snapshots__/jsfmt.spec.js.snap
@@ -93,6 +93,26 @@ class Bar {
 ================================================================================
 `;
 
+exports[`parenthesized-decorators-tagged-template.ts format 1`] = `
+====================================options=====================================
+parsers: ["typescript"]
+printWidth: 80
+                                                                                | printWidth
+=====================================input======================================
+class Test {
+  @foo\`bar\`
+  text: string = "text"
+}
+
+=====================================output=====================================
+class Test {
+  @foo\`bar\`
+  text: string = "text";
+}
+
+================================================================================
+`;
+
 exports[`prettier-ignore-parenthesized-type.ts format 1`] = `
 ====================================options=====================================
 parsers: ["typescript"]
diff --git a/tests/format/misc/typescript-only/parenthesized-decorators-tagged-template.ts b/tests/format/misc/typescript-only/parenthesized-decorators-tagged-template.ts
new file mode 100644
--- /dev/null
+++ b/tests/format/misc/typescript-only/parenthesized-decorators-tagged-template.ts
@@ -0,0 +1,4 @@
+class Test {
+  @foo`bar`
+  text: string = "text"
+}