Repository: prettier/prettier (JavaScript)

Issue:
Prettier adds a colon after 'track'
**Prettier 3.1.1**
[Playground link](https://prettier.io/playground/#N4Igxg9gdgLgprEAuEBLAtgBwgJxgAmHwGEALAQygHM4AROeMGVaAZRh3PioE8AaEhCzQEBAL74AZjiH4AOiAAClKgFcANuRwB6SDjgKA3HKgZseQvgCqsVOvoBnDhB74J02QsXUocLttVbdQBaABM4JxkeIxMTRRtmewjnHgAKAEo44iFsX1hU4BN8fDAKajoGOCYWKCQSMpp6RmY2Di44XgA6AHkoAAVVB1I+IvwHOHUqmFw6hTgAD3IsSYURqGL4Zfa6gANR4sVJXHxU1E38CEl8M7h0B0N8SYJUfABefAASVChw+Ye2sAAa3wACN1BAgelCGJRjs1mJMr55uYCGBNA4HPgAKKLZZwQijSBQSKqJi4DLQ2LrfDUXoASVMMApwBhUFG1AAgpJ4DgAGqoOAAdwZZ2ZrPZVF6ZBUETFVOKtKgjhScqgrJAfBAEEwLWJyFAWhkgr6WgQDmQIHI6kF5B45s1IM4QIYrCWcAAMt84MhJFbxg6nYCXZhyGBvlRkBxVHBNeN0KhIzho5qFpg4DgMKIrQAVdNQLQC81IX3qf0gBzhyYARVUEHgPr9MZAACsHPNWJW4DW697i43NQBHWvwPoyTBFy0OYK+ODhUIakBtOzh7LodDkC1W9QLivUSYcmAcVAg1Qj9Oe3wN0tN0gwdDqADqpBuDhDYDgrDNZ1QADczjwLTADEFx-aMGXCWBWDADMdQ5H52B4SYrzLTAZHGB9OEwC1UIidMf29TVvnGPBR3IKh12QpsQxwYiLRBcgQQmBdUO+GAH1QUIYFIZAAA4AAZNX0IdUH0UjyI3Ptr01GAGPYzjuKQAAmTVBjgbMGKLEsy1uRjQjnd0VFUMi4AAMVwddD3DTdTwgEAxDEIA)
<!-- prettier-ignore -->
```sh
--parser babel
```

**Input:**
<!-- prettier-ignore -->
```jsx
import { ChangeDetectionStrategy, Component } from "@angular/core";
import { UntilDestroy } from "@ngneat/until-destroy";

@UntilDestroy()
@Component({
  changeDetection: ChangeDetectionStrategy.OnPush,
  selector: "example",
  template: `
    @for (item of items; let i = $index; track block) {}
  `,
})
export class Example {
  constructor() {}

  ngOnInit() {}

  ngAfterViewInit() {}

  ngOnChanges() {}

  ngOnDestroy() {}
}

```

**Output:**
<!-- prettier-ignore -->
```jsx
import { ChangeDetectionStrategy, Component } from "@angular/core";
import { UntilDestroy } from "@ngneat/until-destroy";

@UntilDestroy()
@Component({
  changeDetection: ChangeDetectionStrategy.OnPush,
  selector: "example",
  template: `
    @for (item of items; let i = $index; track: block) {}
  `,
})
export class Example {
  constructor() {}

  ngOnInit() {}

  ngAfterViewInit() {}

  ngOnChanges() {}

  ngOnDestroy() {}
}

```

**Expected behavior:**
I was expecting no changes to the Input code, but Prettier adds a colon after 'track' , which is invalid syntax for Angular 17's control flow



Hints:

Patch:
diff --git a/src/language-js/print/angular.js b/src/language-js/print/angular.js
--- a/src/language-js/print/angular.js
+++ b/src/language-js/print/angular.js
@@ -66,7 +66,7 @@ function printAngular(path, options, print) {
           (node.key.name === "then" ||
             node.key.name === "else" ||
             node.key.name === "as")) ||
-          (index === 2 &&
+          ((index === 2 || index === 3) &&
             ((node.key.name === "else" &&
               parent.body[index - 1].type === "NGMicrosyntaxKeyedExpression" &&
               parent.body[index - 1].key.name === "then") ||


Test patch:
diff --git a/tests/format/angular/control-flow/__snapshots__/jsfmt.spec.js.snap b/tests/format/angular/control-flow/__snapshots__/jsfmt.spec.js.snap
--- a/tests/format/angular/control-flow/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/format/angular/control-flow/__snapshots__/jsfmt.spec.js.snap
@@ -285,6 +285,12 @@ item of
   <div *ngFor="item of items; track item"></div>
 </div>
 
+<div>
+  @for (item of items; let i = $index; track block) {}
+
+  <div *ngFor="item of items; let i = $index; track block"></div>
+</div>
+
 =====================================output=====================================
 <ul>
   @for (let item of items; index as i; trackBy: trackByFn) {
@@ -332,6 +338,12 @@ item of
   <div *ngFor="item of items; track item"></div>
 </div>
 
+<div>
+  @for (item of items; let i = $index; track block) {}
+
+  <div *ngFor="item of items; let i = $index; track block"></div>
+</div>
+
 ================================================================================
 `;
 
diff --git a/tests/format/angular/control-flow/for.html b/tests/format/angular/control-flow/for.html
--- a/tests/format/angular/control-flow/for.html
+++ b/tests/format/angular/control-flow/for.html
@@ -52,3 +52,9 @@
 
   <div *ngFor="item of items; track item"></div>
 </div>
+
+<div>
+  @for (item of items; let i = $index; track block) {}
+
+  <div *ngFor="item of items; let i = $index; track block"></div>
+</div>