Repository: prettier/prettier (JavaScript)

Issue:
Allow parentheses when JSDoc to allow intellisense
**Prettier 2.8.3**
[Playground link](https://prettier.io/playground/#N4Igxg9gdgLgprEAuEBbCATArgGzgOjgA8AHCAJxgGcACAXhoHoAqZmgASoEMYBLKgGa84tYACU4kchgA8VGOV5QA5gBoa8xSoB8AXxrNGNABTAAOlBo0AFnBw4ISGgEYAzK4Dsqi7oCUAbhBVEAgSPmgqZFAucnIIAHcABRiESJQuHHiuAE9I4IAjci4wAGs4GABlLlQ4ABklOGQBDKo4AqLS8oqSYqVlZAUsNpA4VHy4DAwJ2q4VLC5lOAAxClQePhVkEC4sGAggkGsYVBwAdWteeCoesDgK1MveADdL7K2wKjyQJVbKRKLlGsmi1hgArKhECp9PAARSwEHgwJwrWCPXIvy2+S44xwBxIWhgp14GBg1mQAA4AAyouKtU5FEhbfEiODkJ6NYIAR3h8H+oTS2yoAFooHAJhMDuQ4NzeFL-gsgUhmsjhq1ULwBuQhsEqNC4ABBGAKXj5XZwRKs+qipEokC6lSwnmNJUg4IwbFEklkpAAJjdRV4OD6AGEIKhFSMqABWA5YVoAFWxaWVtqeQwAklAprAKmBFGF9VmKjBsngbXBdLogA)
<!-- prettier-ignore -->
```sh
--parser babel
```

**Input:**
<!-- prettier-ignore -->
```jsx
module.exports = /** @satisfies {Record<string, string>} */ ({
  hello: 1337,
});
```

**Output:**
<!-- prettier-ignore -->
```jsx
module.exports = /** @satisfies {Record<string, string>} */ {
  hello: 1337,
};

```

**Expected behavior:**
Keep those parentheses to not break intellisense.

```jsx
module.exports = /** @satisfies {Record<string, string>} */ ({
  hello: 1337,
});
```

Here is an example of using `@satisfies` jsdoc. https://github.com/microsoft/TypeScript/pull/51753

![prettier](https://user-images.githubusercontent.com/476567/214179620-3f27356b-9ce1-4dc3-96a8-db30a4441391.gif)



Hints:
It becomes more and more popular to include JSDoc for configs etc. It really improves developer experience to not have to jump into documentation pages for property names and also prevents typos.

Here is for instance Next.js official documentation.
https://nextjs.org/docs/api-reference/next.config.js/introduction
```js
/**
 * @type {import('next').NextConfig}
 */
const nextConfig = {
  /* config options here */
}

module.exports = nextConfig
```

At the moment I have to disable prettier because it removes those parentheses so I wasn't able to use `@satisfies` JSDoc when I had prettier running.

`@type` and `@satisfies` have different use cases. So it's sad if Prettier prevents us from using it.
How do we start a discussion or get some traction on this? What alternatives do we have?

I really want to continue use Prettier it's amazing! I also want to use best practices with JSDoc. Especially when it improves intellisense.

I have no experience with the Prettier team or this codebase. I only have love for what you guys created.

Is there something that I can help with? I don't know how your process work... :)

Patch:
diff --git a/src/language-js/comments.js b/src/language-js/comments.js
--- a/src/language-js/comments.js
+++ b/src/language-js/comments.js
@@ -31,6 +31,7 @@ const {
 } = require("./utils/index.js");
 const { locStart, locEnd } = require("./loc.js");
 const isBlockComment = require("./utils/is-block-comment.js");
+const isTypeCastComment = require("./utils/is-type-cast-comment.js");
 
 /**
  * @typedef {import("./types/estree").Node} Node
@@ -955,21 +956,6 @@ function getCommentChildNodes(node, options) {
   }
 }
 
-/**
- * @param {Comment} comment
- * @returns {boolean}
- */
-function isTypeCastComment(comment) {
-  return (
-    isBlockComment(comment) &&
-    comment.value[0] === "*" &&
-    // TypeScript expects the type to be enclosed in curly brackets, however
-    // Closure Compiler accepts types in parens and even without any delimiters at all.
-    // That's why we just search for "@type".
-    /@type\b/.test(comment.value)
-  );
-}
-
 /**
  * @param {AstPath} path
  * @returns {boolean}
@@ -1005,7 +991,6 @@ module.exports = {
   handleOwnLineComment,
   handleEndOfLineComment,
   handleRemainingComment,
-  isTypeCastComment,
   getCommentChildNodes,
   willPrintOwnComments,
 };
diff --git a/src/language-js/utils/is-type-cast-comment.js b/src/language-js/utils/is-type-cast-comment.js
--- a/src/language-js/utils/is-type-cast-comment.js
+++ b/src/language-js/utils/is-type-cast-comment.js
@@ -16,8 +16,8 @@ function isTypeCastComment(comment) {
     comment.value[0] === "*" &&
     // TypeScript expects the type to be enclosed in curly brackets, however
     // Closure Compiler accepts types in parens and even without any delimiters at all.
-    // That's why we just search for "@type".
-    /@type\b/.test(comment.value)
+    // That's why we just search for "@type" and "@satisfies".
+    /@(?:type|satisfies)\b/.test(comment.value)
   );
 }
 


Test patch:
diff --git a/tests/format/js/comments-closure-typecast/__snapshots__/jsfmt.spec.js.snap b/tests/format/js/comments-closure-typecast/__snapshots__/jsfmt.spec.js.snap
--- a/tests/format/js/comments-closure-typecast/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/format/js/comments-closure-typecast/__snapshots__/jsfmt.spec.js.snap
@@ -571,6 +571,24 @@ const objectWithComment2 = /** @type MyType */ (
 ================================================================================
 `;
 
+exports[`satisfies.js format 1`] = `
+====================================options=====================================
+parsers: ["babel"]
+printWidth: 80
+                                                                                | printWidth
+=====================================input======================================
+module.exports = /** @satisfies {Record<string, string>} */ ({
+  hello: 1337,
+});
+
+=====================================output=====================================
+module.exports = /** @satisfies {Record<string, string>} */ ({
+  hello: 1337,
+});
+
+================================================================================
+`;
+
 exports[`styled-components.js format 1`] = `
 ====================================options=====================================
 parsers: ["babel"]
diff --git a/tests/format/js/comments-closure-typecast/satisfies.js b/tests/format/js/comments-closure-typecast/satisfies.js
new file mode 100644
--- /dev/null
+++ b/tests/format/js/comments-closure-typecast/satisfies.js
@@ -0,0 +1,3 @@
+module.exports = /** @satisfies {Record<string, string>} */ ({
+  hello: 1337,
+});