-
-
Notifications
You must be signed in to change notification settings - Fork 925
Description
oxfmt currently relies on hardcoded file extension checks to determine which parser to use. Specifically, for Angular templates, it only uses the angular parser if the file ends in .component.html.
While this was true for a long time in the Angular community, the updated Style Guide in 2025 now recommends to have component templates named user.html instead of user.component.html, and this is now the default in projects generated via Angular CLI.
As files ending in just .html are treated as generic HTML, this causes formatting issues for Angular Control Flow syntax (@if, @for, @switch), which are not valid in standard HTML and are thus aggressively collapsed or incorrectly indented by the generic html parser.
In Prettier, we usually rely on overrides to work around this:
overrides:
- files: "*.html"
options:
parser: angular
- files: "index.html"
options:
parser: htmlWould it be possible to have a similar feature in oxfmt?
This would allow users to explicitly map file patterns to specific parsers.
Something like:
{
"overrides": [
{
"files": "*.html",
"options": {
"parser": "angular"
}
},
{
"files": "index.html",
"options": {
"parser": "html"
}
}
]
}Metadata
Metadata
Assignees
Labels
Type
Fields
Give feedbackPriority
Start date
Target date
Effort