8000 fix(@schematics/angular): add missing prettier config by jkrems · Pull Request #30590 · angular/angular-cli · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

fix(@schematics/angular): add missing prettier config #30590

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 24, 2025

Conversation

jkrems
Copy link
Contributor
@jkrems jkrems commented Jun 24, 2025

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

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
@jkrems jkrems added the action: review The PR is still awaiting reviews from at least one requested reviewer label Jun 24, 2025
@jkrems jkrems added target: patch This PR is targeted for the next patch release area: @schematics/angular and removed area: @schematics/angular labels Jun 24, 2025
@jkrems jkrems requested a review from alan-agius4 June 24, 2025 17:01
@@ -8,6 +8,16 @@
"watch": "ng build --watch --configuration development"<% if (!minimal) { %>,
"test": "ng test"<% } %>
},
"prettier": {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general, I am not a fan of having tools configured in the package manifest. I’d rather have the additional config file which is clearer.

Thoughts @clydin & @dgp1130 ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That’s a valid point.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there an issue in prettier about that behavior? That seems worth fixing independent of this change.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

okay I will create an issue now

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jkrems jkrems added action: merge The PR is ready for merge by the caretaker and removed action: review The PR is still awaiting reviews from at least one requested reviewer labels Jun 24, 2025
@jkrems jkrems merged commit 4221a33 into angular:main Jun 24, 2025
35 checks passed
@jkrems
Copy link
Contributor Author
jkrems commented Jun 24, 2025

The changes were merged into the following branches: main, 20.0.x

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
action: merge The PR is ready for merge by the caretaker area: @schematics/angular target: patch This PR is targeted for the next patch release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add Default Prettier Configuration for Angular Templates
3 participants
0