From 37e2576ae85654782c993a4abcfec356d83d8922 Mon Sep 17 00:00:00 2001 From: Dany Marques Date: Thu, 14 Aug 2025 13:11:28 +0200 Subject: [PATCH] fix(@schematics/angular): format template files to match Prettier configuration 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. --- .../common-files/src/app/app.html.template | 85 +++++++++++-------- .../common-files/src/index.html.template | 20 ++--- .../src/app/app.config.ts.template | 12 ++- .../standalone-files/src/app/app.ts.template | 2 +- .../standalone-files/src/main.ts.template | 3 +- 5 files changed, 71 insertions(+), 51 deletions(-) diff --git a/packages/schematics/angular/application/files/common-files/src/app/app.html.template b/packages/schematics/angular/application/files/common-files/src/app/app.html.template index b706f5bff17e..b98b0190d2ef 100644 --- a/packages/schematics/angular/application/files/common-files/src/app/app.html.template +++ b/packages/schematics/angular/application/files/common-files/src/app/app.html.template @@ -36,9 +36,18 @@ --pill-accent: var(--bright-blue); - font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, - Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", - "Segoe UI Symbol"; + font-family: + 'Inter', + -apple-system, + BlinkMacSystemFont, + 'Segoe UI', + Roboto, + Helvetica, + Arial, + sans-serif, + 'Apple Color Emoji', + 'Segoe UI Emoji', + 'Segoe UI Symbol'; box-sizing: border-box; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; @@ -51,9 +60,18 @@ line-height: 100%; letter-spacing: -0.125rem; margin: 0; - font-family: "Inter Tight", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, - Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", - "Segoe UI Symbol"; + font-family: + 'Inter Tight', + -apple-system, + BlinkMacSystemFont, + 'Segoe UI', + Roboto, + Helvetica, + Arial, + sans-serif, + 'Apple Color Emoji', + 'Segoe UI Emoji', + 'Segoe UI Symbol'; } p { @@ -214,14 +232,7 @@ - + @@ -236,20 +247,31 @@
- @for (item of [ - { title: 'Explore the Docs', link: 'https://angular.dev' }, - { title: 'Learn with Tutorials', link: 'https://angular.dev/tutorials' }, - { title: 'Prompt and best practices for AI', link: 'https://angular.dev/ai/develop-with-ai'}, - { title: 'CLI Docs', link: 'https://angular.dev/tools/cli' }, - { title: 'Angular Language Service', link: 'https://angular.dev/tools/language-service' }, - { title: 'Angular DevTools', link: 'https://angular.dev/tools/devtools' }, - ]; track item.title) { - + @for ( + item of [ + { title: 'Explore the Docs', link: 'https://angular.dev' }, + { + title: + 'Learn + with Tutorials', + link: 'https://angular.dev/tutorials', + }, + { + title: + 'Prompt and best + practices for AI', + link: 'https://angular.dev/ai/develop-with-ai', + }, + { title: 'CLI Docs', link: 'https://angular.dev/tools/cli' }, + { + title: 'Angular Language Service', + link: 'https://angular.dev/tools/language-service', + }, + { title: 'Angular DevTools', link: 'https://angular.dev/tools/devtools' }, + ]; + track item.title + ) { + {{ item.title }} - + - - - <%= utils.classify(name) %> - - - - - - <<%= selector %>>> - + + + <%= utils.classify(name) %> + + + + + + <<%= selector %>>> + diff --git a/packages/schematics/angular/application/files/standalone-files/src/app/app.config.ts.template b/packages/schematics/angular/application/files/standalone-files/src/app/app.config.ts.template index 638b2acd363a..ee30464cb6d4 100644 --- a/packages/schematics/angular/application/files/standalone-files/src/app/app.config.ts.template +++ b/packages/schematics/angular/application/files/standalone-files/src/app/app.config.ts.template @@ -1,5 +1,9 @@ -import { ApplicationConfig, provideBrowserGlobalErrorListeners, <% if(!zoneless) { %>provideZoneChangeDetection<% } else { %>provideZonelessChangeDetection<% } %> } from '@angular/core';<% if (routing) { %> -import { provideRouter } from '@angular/router'; +import { + ApplicationConfig, + provideBrowserGlobalErrorListeners, + <% if(!zoneless) { %>provideZoneChangeDetection<% } else { %>provideZonelessChangeDetection<% } %>, +} from '@angular/core'; +<% if (routing) { %>import { provideRouter } from '@angular/router'; import { routes } from './app.routes';<% } %> @@ -7,6 +11,6 @@ export const appConfig: ApplicationConfig = { providers: [ provideBrowserGlobalErrorListeners(), <% if(zoneless) { %>provideZonelessChangeDetection()<% } else { %>provideZoneChangeDetection({ eventCoalescing: true })<% } %>, - <% if (routing) {%>provideRouter(routes)<% } %> - ] + <% if (routing) {%>provideRouter(routes)<% } %>, + ], }; diff --git a/packages/schematics/angular/application/files/standalone-files/src/app/app.ts.template b/packages/schematics/angular/application/files/standalone-files/src/app/app.ts.template index 71e7e0bffc24..e2b9d6d1a734 100644 --- a/packages/schematics/angular/application/files/standalone-files/src/app/app.ts.template +++ b/packages/schematics/angular/application/files/standalone-files/src/app/app.ts.template @@ -13,7 +13,7 @@ import { RouterOutlet } from '@angular/router';<% } %> `,<% } else { %> templateUrl: './app.html',<% } if(inlineStyle) { %> styles: [],<% } else { %> - styleUrl: './app.<%= style %>'<% } %> + styleUrl: './app.<%= style %>'<% } %>, }) export class App { protected readonly title = signal('<%= name %>'); diff --git a/packages/schematics/angular/application/files/standalone-files/src/main.ts.template b/packages/schematics/angular/application/files/standalone-files/src/main.ts.template index 5df75f9c838e..190f3418d4db 100644 --- a/packages/schematics/angular/application/files/standalone-files/src/main.ts.template +++ b/packages/schematics/angular/application/files/standalone-files/src/main.ts.template @@ -2,5 +2,4 @@ import { bootstrapApplication } from '@angular/platform-browser'; import { appConfig } from './app/app.config'; import { App } from './app/app'; -bootstrapApplication(App, appConfig) - .catch((err) => console.error(err)); +bootstrapApplication(App, appConfig).catch((err) => console.error(err));