Angular control flow is not formatted in components if using the new simple naming like user-input.ts
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 52.3k
- Forks
- 5k
- Avg merge
- 19h 2m
- Merged PRs (30d)
- 117
Description
Since Angular v20 it is not encouraged any more to use the naming convention user-input.component.ts for components. Instead it is encouraged to use a simpler naming like user-input.ts. If so, the control flow blocks @if() or @for() are not formatted correctly any more.
Using Prettier 3.8.1 in Webstorm 2025.3.2
Not replicable in https://prettier.io/playground)
user-input.component.html
<div>
@for (item of model; track item) {
@if (item === "test") {
<div>{{ item }}</div>
}
}
</div>
user-input.html
<div>
@for (item of model; track item) { @if (item === 'test') {
<div>{{ item }}</div>
} }
</div>
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the formatting difference using the supplied user-input.component.html and user-input.html examples, comparing the output for the two naming conventions. Start by tracing the Angular control-flow formatting path for component templates; done means @for and @if retain the intended nested formatting for both filenames, with the WebStorm case accounted for.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- angular
- Domain
- frontend, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100