Skip to content

fix(@schematics/angular): format template files to match Prettier conf #30916

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

danymarques
Copy link

Applies consistent formatting to Angular schematic template files to prevent changes when Prettier is executed on freshly generated files. The templates now respect the formatting configuration defined in package.json.

PR Checklist

Please check to confirm your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • Other... Please describe:

What is the current behavior?

When we format a file using Prettier on a freshly generated project, it reads the configuration in the package.json and formats the file. It would be nice if the templates were already formatted correctly to avoid unnecessary git changes.

Issue Number: N/A

Templates are formatted following the configuration set in package.json

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

…figuration

Applies consistent formatting to Angular schematic template files to prevent
changes when Prettier is executed on freshly generated files. The templates
now respect the formatting configuration defined in package.json.
@jkrems
Copy link
Contributor

jkrems commented Aug 18, 2025

Thanks, I think this is a good idea overall! But in its current form, it does seem to break some of the additional variants that can be created (https://github.com/angular/angular-cli/actions/runs/16963647619/job/48160598107?pr=30916). I'm a bit concerned that this approach might not be fully generalizable because the correct formatting can change based on the exact options provided, e.g. optional imports or provider array elements.

That said, I'd be happy to merge this kind of formatting-only change assuming that the build passes.

@jkrems jkrems added the action: cleanup The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews label Aug 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
action: cleanup The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews area: @schematics/angular
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants