-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: do not format computed template which could be unexpected (#15972)
- Loading branch information
Showing
4 changed files
with
97 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#### Unexpected embedded formatting for Angular template (#15969 by @JounQin) | ||
|
||
Computed template should not be considered as Angular component template | ||
|
||
<!-- prettier-ignore --> | ||
```ts | ||
// Input | ||
const template = "foobar"; | ||
|
||
@Component({ | ||
[template]: `<h1>{{ hello }}</h1>`, | ||
}) | ||
export class AppComponent {} | ||
|
||
// Prettier stable | ||
const template = "foobar"; | ||
|
||
@Component({ | ||
[template]: `<h1>{{ hello }}</h1>`, | ||
}) | ||
export class AppComponent {} | ||
|
||
// Prettier main | ||
const template = "foobar"; | ||
|
||
@Component({ | ||
[template]: `<h1>{{ hello }}</h1>`, | ||
}) | ||
export class AppComponent {} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
tests/format/typescript/angular-component-examples/15969-computed.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { Component } from '@angular/core'; | ||
|
||
const template = "foobar"; | ||
|
||
@Component({ | ||
[template]: `<h1>{{ hello }}</h1>`, | ||
}) | ||
export class AppComponent {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters