Repository: prettier/prettier (JavaScript)

Issue:
Prettier [error] -> Comment "' + comment.value.trim() + '" was not printed..."
[Playground Link](https://prettier.io/playground/#N4Igxg9gdgLgprEAuEBuABAWwgEwK4A2cAdHAB4AOEATjAM7F0AWcBBAomXGOgLzoAzPFDAwAltHTNWHLmAAUkTJgCGUHAEoAOlHTpg6AG4rq6AmKhw6fKSzak5iiMrU4ANMDpiisJDGp4cAC+GsQQeDAUEYwU5jDyAPRaOgnauugYBBAA5vIARhAEOE4u6hppehgCNOjyxqZi6BZmFlYVevotlnQA2mIAusT+Ypg6HRlNArUAhObdff0a6JCwFoHoCQlSANZiFOh5BGrbXVZjHZk58nNWC+16QeePUCBuIBAU4tB0yKAm1BAAO4ABRMCB+KBUBEBKgAnj83nlqCowNs4DAAMoqTBwAAyrWQAihdDgiORqPRGIoKIs2WQ-kCbzgmDycBwODZuLU2TwKmycAAYjRVDBxFA6ZCIhBXiAmDBMAQAOpMMTwOjUsBwDHg1ViQyq2HIcB0BEgCwk2jA5HZVSE4mkkAAKzoZAxtKIAEU8BB4HaCCS3tTqBajXkVKyCDKKNQLDBFWIcDAmMgABwABkDAJJiuRFCN0ascGohjgMoAjt74FaPhCQCo6ABaSxstky6hwCtidtWvm2pBE-0OkmYMT0gJD91wL0+0v9+1vGDh+OJ5NIABMC+R3lpAGFnH2QFYAKwyvAkgAq4YhA4DIEMgQAkuoEJiwDHPgBBdQYmCwoh+kkgiCIA)

**Input**
```
$ prettier someScript.js --check
```
`someScript.js`
```
; module.exports.shellExec = function shellExec(command)
  { var lines = shell.exec(command,{silent:true}).output.split(/\n/)
  ; log(bold(command))
  ; for (var i in lines)
    { lines[i].trim
    ; if (!lines[i]) continue // skip blank lines
    ; log(lines[i])
    }
  }
```

**Output**

```
Checking formatting...
someScript.js [error] someScript.js: Error: Comment "skip blank lines" was not printed. Please report this error!
[error]     at Object.ensureAllCommentsPrinted (/usr/local/Cellar/prettier/2.5.1/libexec/lib/node_modules/prettier/index.js:13824:13)
[error]     at coreFormat (/usr/local/Cellar/prettier/2.5.1/libexec/lib/node_modules/prettier/index.js:14538:14)
[error]     at formatWithCursor$1 (/usr/local/Cellar/prettier/2.5.1/libexec/lib/node_modules/prettier/index.js:14765:14)
[error]     at Object.formatWithCursor (/usr/local/Cellar/prettier/2.5.1/libexec/lib/node_modules/prettier/index.js:60959:12)
[error]     at format$1 (/usr/local/Cellar/prettier/2.5.1/libexec/lib/node_modules/prettier/bin-prettier.js:18001:21)
[error]     at Object.formatFiles$1 [as formatFiles] (/usr/local/Cellar/prettier/2.5.1/libexec/lib/node_modules/prettier/bin-prettier.js:18115:16)
[error]     at async main (/usr/local/Cellar/prettier/2.5.1/libexec/lib/node_modules/prettier/bin-prettier.js:20216:5)
[error]     at async Object.run (/usr/local/Cellar/prettier/2.5.1/libexec/lib/node_modules/prettier/bin-prettier.js:20159:5)
All matched files use Prettier code style!
```

**Expected Behavior**

```
[warn] someScript.js
[warn] Code style issues found in the above file(s). Forgot to run Prettier?
```

On prettier version 2.5.1.

This is my first issue in this repo, so please let me know if there's something missing from this bug report.


Hints:
Please follow the issue template, i.e. include a reproduction in the Prettier Playground. Here it is: [Playground link](https://prettier.io/playground/#N4Igxg9gdgLgprEAuEBuABAWwgEwK4A2cAdHAB4AOEATjAM7F0AWcBBAomXGOgLzoAzPFDAwAltHTNWHLmAAUkTJgCGUHAEoAOlHTpg6AG4rq6AmKhw6fKSzak5iiMrU4ANMDpiisJDGp4cAC+GsQQeDAUEYwU5jDyAPRaOgnauugYBBAA5vIARhAEOE4u6hppehgCNOjyxqZi6BZmFlYVevotlnQA2mIAusT+Ypg6HRlNArUAhObdff0a6JCwFoHoCQlSANZiFOh5BGrbXVZjHZk58nNWC+16QeePUCBuIBAU4tB0yKAm1BAAO4ABRMCB+KBUBEBKgAnj83nlqCowNs4DAAMoqTBwAAyrWQAihdDgiORqPRGIoKIs2WQ-kCbzgmDycBwODZuLU2TwKmycAAYjRVDBxFA6ZCIhBXiAmDBMAQAOpMMTwOjUsBwDHg1ViQyq2HIcB0BEgCwk2jA5HZVSE4mkkAAKzoZAxtKIAEU8BB4HaCCS3tTqBajXkVKyCDKKNQLDBFWIcDAmMgABwABkDAJJiuRFCN0ascGohjgMoAjt74FaPhCQCo6ABaSxstky6hwCtidtWvm2pBE-0OkmYMT0gJD91wL0+0v9+1vGDh+OJ5NIABMC+R3lpAGFnH2QFYAKwyvAkgAq4YhA4DIEMgQAkuoEJiwDHPgBBdQYmCwoh+kkgiCIA).

Replacing 

```diff
- ; if (!lines[i]) continue // skip blank lines
+ ; if (!lines[i]) continue; // skip blank lines
```

fixes the error. [Playground link](https://prettier.io/playground/#N4Igxg9gdgLgprEAuEBuABAWwgEwK4A2cAdHAB4AOEATjAM7F0AWcBBAomXGOgLzoAzPFDAwAltHTNWHLmAAUkTJgCGUHAEoAOlHTpg6AG4rq6AmKhw6fKSzak5iiMrU4ANMDpiisJDGp4cAC+GsQQeDAUEYwU5jDyAPRaOgnauugYBBAA5vIARhAEOE4u6hppehgCNOjyxqZi6BZmFlYVevotlnQA2mIAusT+Ypg6HRlNArUAhObdff0a6JCwFoHoCQlSANZiFOh5BGrbXVZjHZk58nNWC+16QeePUCBuIBAU4tB0yKAm1BAAO4ABRMCB+KBUBEBKgAnj83nlqCowNs4DAAMoqTBwAAyrWQAihdDgiORqPRGIoKIs2WQ-kCbzgmDycBwODZuLU2TwKmycAAYjRVDBxFA6ZCIhBXiAmDBMAQAOpMMTwOjUsBwDHg1ViQyq2HIcB0BEgCwk2jA5HZVSE4mkkAAKzoZAxtKIAEU8BB4HaCCS3tTqBajXkVKyCDKKNQLDBFWIcDAmMgABwABkDAJJiuRFCN0ascGohjgMoAjt74FaPhCQCo6ABaSxstky6hwCtidtWvm2pBE-0OkmYMT0gJD91wL0+0v9+1vGDh+OJ5NIABMC+R3lpAGFnH2QFYAKwyvAkgAq4YhA4DIEMgQAkuoEJiwDHPgBBdQYmCwoh+kkgiCIA).
Thank you for the information. I was able to resolve the issue but just wanted to make sure the error was reported! 
Thanks! Minimal repro ([Playground](https://prettier.io/playground/#N4Igxg9gdgLgprEAuEAzCAnABACgNx4CUWksAllAK5xYD0tJEAtkwjADpR4gA0IEABxhloAZ2SgAhhgwQA7gAVpCcSkkAbOZICe4vgCMMksAGs4MAMqTWAGQpxkqDaLgGjp8xYHGKAc2QwGNR8cEz6cAAmEZE2klC+lJK+cABimEySMMLxyCCSlDAQvCAAFjBM6gDqJWTwot5gcBYqtWQAbrXauWCieiAULhgwCka+GY7OriAAVqIAHhZ+6nAAipQQ8BPqLnzeGIO5+pLh6sUCGBQwlWQRMCXIABwADLuyLpVGArnncINtDnwAI7reAjQSqPKiAC0UDgkUixQwcGBZCRIyS4yQTm2UxcTDIASCuKWqxBDixkz4MGO11u9yQACYqUYyOo-ABhZiYkC-ACsxUoLgAKsdVNidiA2tQAJJQaKwCxgC5CACCcosMG0yy2LgAvrqgA)):

```js
for (;;) continue // comment
;
```

Parser = flow, babel*, typescript, espree

Looks like it’s to do with an empty statement following `continue // comment \n`. Removing `;` on the following line or replacing it with `a;` prevents the error.

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
@@ -68,6 +68,7 @@ function handleOwnLineComment(context) {
     handleAssignmentPatternComments,
     handleMethodNameComments,
     handleLabeledStatementComments,
+    handleBreakAndContinueStatementComments,
   ].some((fn) => fn(context));
 }
 
@@ -91,6 +92,7 @@ function handleEndOfLineComment(context) {
     handleOnlyComments,
     handleTypeAliasComments,
     handleVariableDeclaratorComments,
+    handleBreakAndContinueStatementComments,
   ].some((fn) => fn(context));
 }
 


Test patch:
diff --git a/tests/config/format-test.js b/tests/config/format-test.js
--- a/tests/config/format-test.js
+++ b/tests/config/format-test.js
@@ -39,6 +39,7 @@ const unstableTests = new Map(
     ["flow/no-semi/comments.js", (options) => options.semi === false],
     "typescript/prettier-ignore/mapped-types.ts",
     "js/comments/html-like/comment.js",
+    "js/for/continue-and-break-comment-without-blocks.js",
   ].map((fixture) => {
     const [file, isUnstable = () => true] = Array.isArray(fixture)
       ? fixture
diff --git a/tests/format/js/for/__snapshots__/jsfmt.spec.js.snap b/tests/format/js/for/__snapshots__/jsfmt.spec.js.snap
--- a/tests/format/js/for/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/format/js/for/__snapshots__/jsfmt.spec.js.snap
@@ -74,6 +74,709 @@ for (x of y);
 ================================================================================
 `;
 
+exports[`continue-and-break-comment-1.js format 1`] = `
+====================================options=====================================
+parsers: ["babel", "flow", "typescript"]
+printWidth: 80
+                                                                                | printWidth
+=====================================input======================================
+for(;;) {
+    continue // comment
+    ;
+}
+
+for (;;) {
+    break // comment
+    ;
+}
+
+for (const f of []) {
+    continue // comment
+    ;
+}
+
+for (const f of []) {
+    break // comment
+    ;
+}
+
+for (const f in {}) {
+    continue // comment
+    ;
+}
+
+for (const f in {}) {
+    break // comment
+    ;
+}
+
+while(true) {
+    continue // comment
+    ;
+}
+
+while (true) {
+    break // comment
+    ;
+}
+
+do {
+    continue // comment
+    ;
+} while(true);
+
+
+do {
+    break // comment
+    ;
+} while(true);
+
+label1: for (;;) {
+    continue label1 // comment
+    ;
+}
+
+label2: {
+    break label2 // comment
+    ;
+};
+
+for(;;) {
+    continue /* comment */
+    ;
+}
+
+for (;;) {
+    break /* comment */
+    ;
+}
+
+for (const f of []) {
+    continue /* comment */
+    ;
+}
+
+for (const f of []) {
+    break /* comment */
+    ;
+}
+
+for (const f in {}) {
+    continue /* comment */
+    ;
+}
+
+for (const f in {}) {
+    break /* comment */
+    ;
+}
+
+while(true) {
+    continue /* comment */
+    ;
+}
+
+while (true) {
+    break /* comment */
+    ;
+}
+
+do {
+    continue /* comment */
+    ;
+} while(true);
+
+
+do {
+    break /* comment */
+    ;
+} while(true);
+
+label1: for (;;) {
+    continue label1 /* comment */
+    ;
+}
+
+label2: {
+    break label2 /* comment */
+    ;
+};
+
+=====================================output=====================================
+for (;;) {
+  continue; // comment
+}
+
+for (;;) {
+  break; // comment
+}
+
+for (const f of []) {
+  continue; // comment
+}
+
+for (const f of []) {
+  break; // comment
+}
+
+for (const f in {}) {
+  continue; // comment
+}
+
+for (const f in {}) {
+  break; // comment
+}
+
+while (true) {
+  continue; // comment
+}
+
+while (true) {
+  break; // comment
+}
+
+do {
+  continue; // comment
+} while (true);
+
+do {
+  break; // comment
+} while (true);
+
+label1: for (;;) {
+  continue label1; // comment
+}
+
+label2: {
+  break label2; // comment
+}
+
+for (;;) {
+  continue; /* comment */
+}
+
+for (;;) {
+  break; /* comment */
+}
+
+for (const f of []) {
+  continue; /* comment */
+}
+
+for (const f of []) {
+  break; /* comment */
+}
+
+for (const f in {}) {
+  continue; /* comment */
+}
+
+for (const f in {}) {
+  break; /* comment */
+}
+
+while (true) {
+  continue; /* comment */
+}
+
+while (true) {
+  break; /* comment */
+}
+
+do {
+  continue; /* comment */
+} while (true);
+
+do {
+  break; /* comment */
+} while (true);
+
+label1: for (;;) {
+  continue label1 /* comment */;
+}
+
+label2: {
+  break label2 /* comment */;
+}
+
+================================================================================
+`;
+
+exports[`continue-and-break-comment-2.js format 1`] = `
+====================================options=====================================
+parsers: ["babel", "flow", "typescript"]
+printWidth: 80
+                                                                                | printWidth
+=====================================input======================================
+for(;;) {
+    continue
+    // comment
+    ;
+}
+
+for (;;) {
+    break
+    // comment
+    ;
+}
+
+for (const f of []) {
+    continue
+    // comment
+    ;
+}
+
+for (const f of []) {
+    break
+    // comment
+    ;
+}
+
+for (const f in {}) {
+    continue
+    // comment
+    ;
+}
+
+for (const f in {}) {
+    break
+    // comment
+    ;
+}
+
+while(true) {
+    continue
+    // comment
+    ;
+}
+
+while (true) {
+    break
+    // comment
+    ;
+}
+
+do {
+    continue
+    // comment
+    ;
+} while(true);
+
+
+do {
+    break
+    // comment
+    ;
+} while(true);
+
+label1: for (;;) {
+    continue label1
+    // comment
+    ;
+}
+
+label2: {
+    break label2
+    // comment
+    ;
+};
+
+for(;;) {
+    continue
+    /* comment */
+    ;
+}
+
+for (;;) {
+    break
+    /* comment */
+    ;
+}
+
+for (const f of []) {
+    continue
+    /* comment */
+    ;
+}
+
+for (const f of []) {
+    break
+    /* comment */
+    ;
+}
+
+for (const f in {}) {
+    continue
+    /* comment */
+    ;
+}
+
+for (const f in {}) {
+    break
+    /* comment */
+    ;
+}
+
+while(true) {
+    continue
+    /* comment */
+    ;
+}
+
+while (true) {
+    break
+    /* comment */
+    ;
+}
+
+do {
+    continue
+    /* comment */
+    ;
+} while(true);
+
+
+do {
+    break
+    /* comment */
+    ;
+} while(true);
+
+label1: for (;;) {
+    continue label1
+    /* comment */
+    ;
+}
+
+label2: {
+    break label2
+    /* comment */
+    ;
+};
+
+=====================================output=====================================
+for (;;) {
+  continue;
+  // comment
+}
+
+for (;;) {
+  break;
+  // comment
+}
+
+for (const f of []) {
+  continue;
+  // comment
+}
+
+for (const f of []) {
+  break;
+  // comment
+}
+
+for (const f in {}) {
+  continue;
+  // comment
+}
+
+for (const f in {}) {
+  break;
+  // comment
+}
+
+while (true) {
+  continue;
+  // comment
+}
+
+while (true) {
+  break;
+  // comment
+}
+
+do {
+  continue;
+  // comment
+} while (true);
+
+do {
+  break;
+  // comment
+} while (true);
+
+label1: for (;;) {
+  continue label1;
+  // comment
+}
+
+label2: {
+  break label2;
+  // comment
+}
+
+for (;;) {
+  continue;
+  /* comment */
+}
+
+for (;;) {
+  break;
+  /* comment */
+}
+
+for (const f of []) {
+  continue;
+  /* comment */
+}
+
+for (const f of []) {
+  break;
+  /* comment */
+}
+
+for (const f in {}) {
+  continue;
+  /* comment */
+}
+
+for (const f in {}) {
+  break;
+  /* comment */
+}
+
+while (true) {
+  continue;
+  /* comment */
+}
+
+while (true) {
+  break;
+  /* comment */
+}
+
+do {
+  continue;
+  /* comment */
+} while (true);
+
+do {
+  break;
+  /* comment */
+} while (true);
+
+label1: for (;;) {
+  continue label1;
+  /* comment */
+}
+
+label2: {
+  break label2;
+  /* comment */
+}
+
+================================================================================
+`;
+
+exports[`continue-and-break-comment-without-blocks.js format 1`] = `
+====================================options=====================================
+parsers: ["babel", "flow", "typescript"]
+printWidth: 80
+                                                                                | printWidth
+=====================================input======================================
+for(;;) continue
+// comment
+;
+
+for (;;) break
+// comment
+;
+
+for (const f of []) continue
+// comment
+;
+
+for (const f of []) break
+// comment
+;
+
+for (const f in {}) continue
+// comment
+;
+
+for (const f in {}) break
+// comment
+;
+
+for(;;) continue // comment
+;
+
+for (;;) break // comment
+;
+
+for (const f of []) continue // comment
+;
+
+for (const f of []) break // comment
+;
+
+for (const f in {}) continue // comment
+;
+
+for (const f in {}) break // comment
+;
+
+for(;;) continue /* comment */
+;
+
+for (;;) break /* comment */
+;
+
+for (const f of []) continue /* comment */
+;
+
+for (const f of []) break /* comment */
+;
+
+for (const f in {}) continue /* comment */
+;
+
+for (const f in {}) break /* comment */
+;
+
+for(;;) continue
+/* comment */
+;
+
+for (;;) break
+/* comment */
+;
+
+for (const f of []) continue
+/* comment */
+;
+
+for (const f of []) break
+/* comment */
+;
+
+for (const f in {}) continue
+/* comment */
+;
+
+for (const f in {}) break
+/* comment */
+;
+
+label1: for (;;) continue label1 /* comment */
+;
+
+label1: for (;;) continue label1
+/* comment */
+;
+
+label1: for (;;) continue label1 // comment
+;
+
+label1: for (;;) continue label1
+// comment
+;
+
+=====================================output=====================================
+for (;;)
+  continue;
+  // comment
+
+for (;;)
+  break;
+  // comment
+
+for (const f of [])
+  continue;
+  // comment
+
+for (const f of [])
+  break;
+  // comment
+
+for (const f in {})
+  continue;
+  // comment
+
+for (const f in {})
+  break;
+  // comment
+
+for (;;)
+  continue; // comment
+
+for (;;)
+  break; // comment
+
+for (const f of [])
+  continue; // comment
+
+for (const f of [])
+  break; // comment
+
+for (const f in {})
+  continue; // comment
+
+for (const f in {})
+  break; // comment
+
+for (;;) continue; /* comment */
+
+for (;;) break; /* comment */
+
+for (const f of []) continue; /* comment */
+
+for (const f of []) break; /* comment */
+
+for (const f in {}) continue; /* comment */
+
+for (const f in {}) break; /* comment */
+
+for (;;)
+  continue;
+  /* comment */
+
+for (;;)
+  break;
+  /* comment */
+
+for (const f of [])
+  continue;
+  /* comment */
+
+for (const f of [])
+  break;
+  /* comment */
+
+for (const f in {})
+  continue;
+  /* comment */
+
+for (const f in {})
+  break;
+  /* comment */
+
+label1: for (;;) continue label1 /* comment */;
+
+label1: for (;;)
+  continue label1;
+  /* comment */
+
+label1: for (;;)
+  continue label1; // comment
+
+label1: for (;;)
+  continue label1;
+  // comment
+
+================================================================================
+`;
+
 exports[`for.js format 1`] = `
 ====================================options=====================================
 parsers: ["babel", "flow", "typescript"]
diff --git a/tests/format/js/for/continue-and-break-comment-1.js b/tests/format/js/for/continue-and-break-comment-1.js
new file mode 100644
--- /dev/null
+++ b/tests/format/js/for/continue-and-break-comment-1.js
@@ -0,0 +1,121 @@
+for(;;) {
+    continue // comment
+    ;
+}
+
+for (;;) {
+    break // comment
+    ;
+}
+
+for (const f of []) {
+    continue // comment
+    ;
+}
+
+for (const f of []) {
+    break // comment
+    ;
+}
+
+for (const f in {}) {
+    continue // comment
+    ;
+}
+
+for (const f in {}) {
+    break // comment
+    ;
+}
+
+while(true) {
+    continue // comment
+    ;
+}
+
+while (true) {
+    break // comment
+    ;
+}
+
+do {
+    continue // comment
+    ;
+} while(true);
+
+
+do {
+    break // comment
+    ;
+} while(true);
+
+label1: for (;;) {
+    continue label1 // comment
+    ;
+}
+
+label2: {
+    break label2 // comment
+    ;
+};
+
+for(;;) {
+    continue /* comment */
+    ;
+}
+
+for (;;) {
+    break /* comment */
+    ;
+}
+
+for (const f of []) {
+    continue /* comment */
+    ;
+}
+
+for (const f of []) {
+    break /* comment */
+    ;
+}
+
+for (const f in {}) {
+    continue /* comment */
+    ;
+}
+
+for (const f in {}) {
+    break /* comment */
+    ;
+}
+
+while(true) {
+    continue /* comment */
+    ;
+}
+
+while (true) {
+    break /* comment */
+    ;
+}
+
+do {
+    continue /* comment */
+    ;
+} while(true);
+
+
+do {
+    break /* comment */
+    ;
+} while(true);
+
+label1: for (;;) {
+    continue label1 /* comment */
+    ;
+}
+
+label2: {
+    break label2 /* comment */
+    ;
+};
diff --git a/tests/format/js/for/continue-and-break-comment-2.js b/tests/format/js/for/continue-and-break-comment-2.js
new file mode 100644
--- /dev/null
+++ b/tests/format/js/for/continue-and-break-comment-2.js
@@ -0,0 +1,145 @@
+for(;;) {
+    continue
+    // comment
+    ;
+}
+
+for (;;) {
+    break
+    // comment
+    ;
+}
+
+for (const f of []) {
+    continue
+    // comment
+    ;
+}
+
+for (const f of []) {
+    break
+    // comment
+    ;
+}
+
+for (const f in {}) {
+    continue
+    // comment
+    ;
+}
+
+for (const f in {}) {
+    break
+    // comment
+    ;
+}
+
+while(true) {
+    continue
+    // comment
+    ;
+}
+
+while (true) {
+    break
+    // comment
+    ;
+}
+
+do {
+    continue
+    // comment
+    ;
+} while(true);
+
+
+do {
+    break
+    // comment
+    ;
+} while(true);
+
+label1: for (;;) {
+    continue label1
+    // comment
+    ;
+}
+
+label2: {
+    break label2
+    // comment
+    ;
+};
+
+for(;;) {
+    continue
+    /* comment */
+    ;
+}
+
+for (;;) {
+    break
+    /* comment */
+    ;
+}
+
+for (const f of []) {
+    continue
+    /* comment */
+    ;
+}
+
+for (const f of []) {
+    break
+    /* comment */
+    ;
+}
+
+for (const f in {}) {
+    continue
+    /* comment */
+    ;
+}
+
+for (const f in {}) {
+    break
+    /* comment */
+    ;
+}
+
+while(true) {
+    continue
+    /* comment */
+    ;
+}
+
+while (true) {
+    break
+    /* comment */
+    ;
+}
+
+do {
+    continue
+    /* comment */
+    ;
+} while(true);
+
+
+do {
+    break
+    /* comment */
+    ;
+} while(true);
+
+label1: for (;;) {
+    continue label1
+    /* comment */
+    ;
+}
+
+label2: {
+    break label2
+    /* comment */
+    ;
+};
diff --git a/tests/format/js/for/continue-and-break-comment-without-blocks.js b/tests/format/js/for/continue-and-break-comment-without-blocks.js
new file mode 100644
--- /dev/null
+++ b/tests/format/js/for/continue-and-break-comment-without-blocks.js
@@ -0,0 +1,97 @@
+for(;;) continue
+// comment
+;
+
+for (;;) break
+// comment
+;
+
+for (const f of []) continue
+// comment
+;
+
+for (const f of []) break
+// comment
+;
+
+for (const f in {}) continue
+// comment
+;
+
+for (const f in {}) break
+// comment
+;
+
+for(;;) continue // comment
+;
+
+for (;;) break // comment
+;
+
+for (const f of []) continue // comment
+;
+
+for (const f of []) break // comment
+;
+
+for (const f in {}) continue // comment
+;
+
+for (const f in {}) break // comment
+;
+
+for(;;) continue /* comment */
+;
+
+for (;;) break /* comment */
+;
+
+for (const f of []) continue /* comment */
+;
+
+for (const f of []) break /* comment */
+;
+
+for (const f in {}) continue /* comment */
+;
+
+for (const f in {}) break /* comment */
+;
+
+for(;;) continue
+/* comment */
+;
+
+for (;;) break
+/* comment */
+;
+
+for (const f of []) continue
+/* comment */
+;
+
+for (const f of []) break
+/* comment */
+;
+
+for (const f in {}) continue
+/* comment */
+;
+
+for (const f in {}) break
+/* comment */
+;
+
+label1: for (;;) continue label1 /* comment */
+;
+
+label1: for (;;) continue label1
+/* comment */
+;
+
+label1: for (;;) continue label1 // comment
+;
+
+label1: for (;;) continue label1
+// comment
+;
diff --git a/tests/format/misc/errors/typescript/__snapshots__/jsfmt.spec.js.snap b/tests/format/misc/errors/typescript/__snapshots__/jsfmt.spec.js.snap
--- a/tests/format/misc/errors/typescript/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/format/misc/errors/typescript/__snapshots__/jsfmt.spec.js.snap
@@ -23,8 +23,6 @@ exports[`invalid-jsx-1.ts [typescript] format 1`] = `
   4 |"
 `;
 
-exports[`issue-8773.ts [typescript] format 1`] = `"Comment \\"comment\\" was not printed. Please report this error!"`;
-
 exports[`module-attributes-static.ts [typescript] format 1`] = `
 "';' expected. (1:28)
 > 1 | import foo from \\"foo.json\\" with type: \\"json\\";
diff --git a/tests/format/misc/errors/typescript/issue-8773.ts b/tests/format/misc/errors/typescript/issue-8773.ts
deleted file mode 100644
--- a/tests/format/misc/errors/typescript/issue-8773.ts
+++ /dev/null
@@ -1,5 +0,0 @@
-// prettier-ignore
-foo +      foo;
-
-continue // comment
-;