fix(@schematics/angular): add missing prettier config#30590
fix(@schematics/angular): add missing prettier config#30590hybrist merged 1 commit intoangular:mainfrom
Conversation
The current style guide no longer enforces the use of the template file extension `.component.html`. This means that prettier won't auto-detect the proper parser for these files anymore. To ensure template formatting works out-of-the-box, we're adding a prettier config to newly created projects. Fixes angular#30548
| "watch": "ng build --watch --configuration development"<% if (!minimal) { %>, | ||
| "test": "ng test"<% } %> | ||
| }, | ||
| "prettier": { |
There was a problem hiding this comment.
My thinking here was that creating a dedicated file may be more confusing for people who don't actively use prettier. It feels a bit less boilerplate-y. But I don't have super strong opinions either way.
There was a problem hiding this comment.
That’s a valid point.
There was a problem hiding this comment.
actually this will be super confusing for anyone using prettier since creating a prettierrc file will have zero affect (prettier doesn't merge configurations but only take one; and the one inside the package.json has the highest order)
and I'm talking from experience because I faced it before myself as in one repo someone configured prettier in the package.json and I was trying to add one plugin and it wasn't working and it took me forever to figure out why
There was a problem hiding this comment.
Is there an issue in prettier about that behavior? That seems worth fixing independent of this change.
There was a problem hiding this comment.
it's how it works
I can open an issue there and see where it goes, but I don't think they will change this behavior since it can lead to many repos being broken
There was a problem hiding this comment.
Sorry, I wasn't talking about changing the behavior. I was talking about silently ignoring a config file that's clearly "meant" to be used (it's called prettierrc after all) and not warning the user about it. Printing a warning should hopefully not break anything and would remove this confusion?
|
The changes were merged into the following branches: main, 20.0.x |
|
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
The current style guide no longer enforces the use of the template file extension
.component.html. This means that prettier won't auto-detect the proper parser for these files anymore.To ensure template formatting works out-of-the-box, we're adding a prettier config to newly created projects.
Fixes #30548