Repository: jhipster/jhipster-lite
Pull request #10299 (2024-07-16 19:41:50)

Prettier: fix warnings on Angular generated app
Related to #10279 


Patch:
diff --git a/src/main/java/tech/jhipster/lite/generator/client/angular/security/oauth2/domain/AngularOauth2ModuleFactory.java b/src/main/java/tech/jhipster/lite/generator/client/angular/security/oauth2/domain/AngularOauth2ModuleFactory.java
index 3da5ef6ff..f84abed21 100644
--- a/src/main/java/tech/jhipster/lite/generator/client/angular/security/oauth2/domain/AngularOauth2ModuleFactory.java
+++ b/src/main/java/tech/jhipster/lite/generator/client/angular/security/oauth2/domain/AngularOauth2ModuleFactory.java
@@ -27,7 +27,7 @@ public class AngularOauth2ModuleFactory {
     keycloak: {
       url: 'http://localhost:9080',
       realm: 'jhipster',
-      client_id: 'web_app'
+      client_id: 'web_app',
     },
     """;
 
@@ -58,7 +58,7 @@ public class AngularOauth2ModuleFactory {
   private static final String TEST_IMPORTS =
     """
     import { By } from '@angular/platform-browser';
-    import { Oauth2AuthService } from "./auth/oauth2-auth.service";
+    import { Oauth2AuthService } from './auth/oauth2-auth.service';
     import LoginComponent from './login/login.component';
     """;
   private static final ElementReplacer TEST_NEEDLE = lineAfterRegex("^\\s+it\\('should have appName',[^}]+\\}\\);");
diff --git a/src/main/resources/generator/client/angular/core/src/main/webapp/app/app.component.css.mustache b/src/main/resources/generator/client/angular/core/src/main/webapp/app/app.component.css.mustache
index bdceab7d5..744906519 100644
--- a/src/main/resources/generator/client/angular/core/src/main/webapp/app/app.component.css.mustache
+++ b/src/main/resources/generator/client/angular/core/src/main/webapp/app/app.component.css.mustache
@@ -5,8 +5,8 @@
 
 .jhipster-logo {
   display: block;
-  margin-left:auto;
-  margin-right:auto;
+  margin-left: auto;
+  margin-right: auto;
   margin-top: 20px;
   width: 250px;
 }
diff --git a/src/main/resources/generator/client/angular/core/src/main/webapp/app/app.component.html.mustache b/src/main/resources/generator/client/angular/core/src/main/webapp/app/app.component.html.mustache
index 6f5cea3e8..e5e27f174 100644
--- a/src/main/resources/generator/client/angular/core/src/main/webapp/app/app.component.html.mustache
+++ b/src/main/resources/generator/client/angular/core/src/main/webapp/app/app.component.html.mustache
@@ -11,7 +11,14 @@
   <span class="space-separator" id="menu-space-separator"></span>
 </mat-toolbar>
 
-<img alt="JHipster logo" class="jhipster-logo" ngSrc="../../../../content/images/JHipster-Lite-neon-red.png" width="250" height="47" priority />
+<img
+  alt="JHipster logo"
+  class="jhipster-logo"
+  ngSrc="../../../../content/images/JHipster-Lite-neon-red.png"
+  width="250"
+  height="47"
+  priority
+/>
 
 <router-outlet></router-outlet>
 
diff --git a/src/main/resources/generator/client/angular/core/src/main/webapp/app/app.component.spec.ts.mustache b/src/main/resources/generator/client/angular/core/src/main/webapp/app/app.component.spec.ts.mustache
index 552a89c43..dd548c514 100644
--- a/src/main/resources/generator/client/angular/core/src/main/webapp/app/app.component.spec.ts.mustache
+++ b/src/main/resources/generator/client/angular/core/src/main/webapp/app/app.component.spec.ts.mustache
@@ -7,13 +7,11 @@ describe('App Component', () => {
   let comp: AppComponent;
   let fixture: ComponentFixture<AppComponent>;
 
-  beforeEach(
-    waitForAsync(() => {
-      TestBed.configureTestingModule({
-        providers: [provideRouter([])],
-      }).compileComponents();
-    })
-  );
+  beforeEach(waitForAsync(() => {
+    TestBed.configureTestingModule({
+      providers: [provideRouter([])],
+    }).compileComponents();
+  }));
 
   beforeEach(() => {
     fixture = TestBed.createComponent(AppComponent);
@@ -29,5 +27,4 @@ describe('App Component', () => {
       expect(comp.appName).toEqual('{{baseName}}');
     });
   });
-
 });
diff --git a/src/main/resources/generator/client/angular/core/src/main/webapp/environments/environment.prod.ts.mustache b/src/main/resources/generator/client/angular/core/src/main/webapp/environments/environment.prod.ts.mustache
index 3612073bc..c9669790b 100644
--- a/src/main/resources/generator/client/angular/core/src/main/webapp/environments/environment.prod.ts.mustache
+++ b/src/main/resources/generator/client/angular/core/src/main/webapp/environments/environment.prod.ts.mustache
@@ -1,3 +1,3 @@
 export const environment = {
-  production: true
+  production: true,
 };
diff --git a/src/main/resources/generator/client/angular/core/src/main/webapp/environments/environment.ts.mustache b/src/main/resources/generator/client/angular/core/src/main/webapp/environments/environment.ts.mustache
index ffe8aed76..a20cfe557 100644
--- a/src/main/resources/generator/client/angular/core/src/main/webapp/environments/environment.ts.mustache
+++ b/src/main/resources/generator/client/angular/core/src/main/webapp/environments/environment.ts.mustache
@@ -1,3 +1,3 @@
 export const environment = {
-  production: false
+  production: false,
 };
diff --git a/src/main/resources/generator/client/angular/core/src/main/webapp/index.html.mustache b/src/main/resources/generator/client/angular/core/src/main/webapp/index.html.mustache
index 7fefd9dde..7b22f10e2 100644
--- a/src/main/resources/generator/client/angular/core/src/main/webapp/index.html.mustache
+++ b/src/main/resources/generator/client/angular/core/src/main/webapp/index.html.mustache
@@ -1,4 +1,4 @@
-<!DOCTYPE html>
+<!doctype html>
 <html lang="en">
   <head>
     <meta charset="utf-8" />
@@ -6,11 +6,11 @@
     <base href="/" />
     <meta name="description" content="JHipster Lite project" />
     <meta name="viewport" content="width=device-width, initial-scale=1" />
-    <link rel="preconnect" href="https://fonts.gstatic.com">
-    <link href="https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500&display=swap" rel="stylesheet">
-    <link href="https://fonts.googleapis.com/icon?family=Material+Icons&display=swap" rel="stylesheet">
-</head>
+    <link rel="preconnect" href="https://fonts.gstatic.com" />
+    <link href="https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500&display=swap" rel="stylesheet" />
+    <link href="https://fonts.googleapis.com/icon?family=Material+Icons&display=swap" rel="stylesheet" />
+  </head>
   <body class="mat-typography">
-  <jhi-root></jhi-root>
+    <jhi-root></jhi-root>
   </body>
 </html>
diff --git a/src/main/resources/generator/client/angular/core/src/main/webapp/styles.css.mustache b/src/main/resources/generator/client/angular/core/src/main/webapp/styles.css.mustache
index 7e7239a2e..3b9cecf7b 100644
--- a/src/main/resources/generator/client/angular/core/src/main/webapp/styles.css.mustache
+++ b/src/main/resources/generator/client/angular/core/src/main/webapp/styles.css.mustache
@@ -1,4 +1,10 @@
 /* You can add global styles to this file, and also import other style files */
 
-html, body { height: 100%; }
-body { margin: 0; font-family: Roboto, "Helvetica Neue", sans-serif; }
+html,
+body {
+  height: 100%;
+}
+body {
+  margin: 0;
+  font-family: Roboto, 'Helvetica Neue', sans-serif;
+}
diff --git a/src/main/resources/generator/client/angular/security/jwt/src/main/webapp/app/auth/account.model.spec.ts.mustache b/src/main/resources/generator/client/angular/security/jwt/src/main/webapp/app/auth/account.model.spec.ts.mustache
index 60b1390ab..8e6cbe1b1 100644
--- a/src/main/resources/generator/client/angular/security/jwt/src/main/webapp/app/auth/account.model.spec.ts.mustache
+++ b/src/main/resources/generator/client/angular/security/jwt/src/main/webapp/app/auth/account.model.spec.ts.mustache
@@ -1,7 +1,6 @@
 import { Account } from './account.model';
 
 describe('AccountModel', () => {
-
   it('should initialize an account model', () => {
     // GIVEN
     const activated = true;
@@ -24,5 +23,4 @@ describe('AccountModel', () => {
     expect(account.lastName).toBe(lastName);
     expect(account.login).toBe(login);
   });
-
 });
diff --git a/src/main/resources/generator/client/angular/security/jwt/src/main/webapp/app/auth/account.model.ts.mustache b/src/main/resources/generator/client/angular/security/jwt/src/main/webapp/app/auth/account.model.ts.mustache
index 591dc1a65..702a9ccc3 100644
--- a/src/main/resources/generator/client/angular/security/jwt/src/main/webapp/app/auth/account.model.ts.mustache
+++ b/src/main/resources/generator/client/angular/security/jwt/src/main/webapp/app/auth/account.model.ts.mustache
@@ -6,6 +6,6 @@ export class Account {
     public firstName: string | null,
     public langKey: string,
     public lastName: string | null,
-    public login: string
+    public login: string,
   ) {}
 }
diff --git a/src/main/resources/generator/client/angular/security/jwt/src/main/webapp/app/auth/account.service.ts.mustache b/src/main/resources/generator/client/angular/security/jwt/src/main/webapp/app/auth/account.service.ts.mustache
index 2582d5f66..4c8bb4cd9 100644
--- a/src/main/resources/generator/client/angular/security/jwt/src/main/webapp/app/auth/account.service.ts.mustache
+++ b/src/main/resources/generator/client/angular/security/jwt/src/main/webapp/app/auth/account.service.ts.mustache
@@ -37,7 +37,7 @@ export class AccountService {
         tap((account: Account) => {
           this.authenticate(account);
         }),
-        shareReplay()
+        shareReplay(),
       );
     }
     return this.accountCache$.pipe(catchError(() => of(null)));
diff --git a/src/main/resources/generator/client/angular/security/jwt/src/main/webapp/app/auth/auth.interceptor.spec.ts.mustache b/src/main/resources/generator/client/angular/security/jwt/src/main/webapp/app/auth/auth.interceptor.spec.ts.mustache
index 888c7e9c9..9122fbf82 100644
--- a/src/main/resources/generator/client/angular/security/jwt/src/main/webapp/app/auth/auth.interceptor.spec.ts.mustache
+++ b/src/main/resources/generator/client/angular/security/jwt/src/main/webapp/app/auth/auth.interceptor.spec.ts.mustache
@@ -11,12 +11,7 @@ describe('Auth Interceptor', () => {
 
   beforeEach(() => {
     TestBed.configureTestingModule({
-      providers: [
-        provideHttpClient(
-          withInterceptors([authInterceptor])
-        ),
-        provideHttpClientTesting(),
-      ],
+      providers: [provideHttpClient(withInterceptors([authInterceptor])), provideHttpClientTesting()],
     });
 
     httpMock = TestBed.inject(HttpTestingController);
diff --git a/src/main/resources/generator/client/angular/security/jwt/src/main/webapp/app/login/login.component.ts.mustache b/src/main/resources/generator/client/angular/security/jwt/src/main/webapp/app/login/login.component.ts.mustache
index a8016dbb8..157fca506 100644
--- a/src/main/resources/generator/client/angular/security/jwt/src/main/webapp/app/login/login.component.ts.mustache
+++ b/src/main/resources/generator/client/angular/security/jwt/src/main/webapp/app/login/login.component.ts.mustache
@@ -46,7 +46,7 @@ export default class LoginComponent implements OnInit {
     this.accountService
       .getAuthenticationState()
       .pipe(takeUntil(this.destroy$))
-      .subscribe(account => (this.account.set(account)));
+      .subscribe(account => this.account.set(account));
   }
 
   login(): void {
@@ -56,7 +56,7 @@ export default class LoginComponent implements OnInit {
         password: this.loginForm.value.password!,
       })
       .subscribe({
-        error: (e) => this.updateErrorMessage(e)
+        error: e => this.updateErrorMessage(e),
       });
   }
 
diff --git a/src/main/resources/generator/client/angular/security/jwt/src/main/webapp/app/login/login.model.ts.mustache b/src/main/resources/generator/client/angular/security/jwt/src/main/webapp/app/login/login.model.ts.mustache
index 66aca2b49..ed14e6b7c 100644
--- a/src/main/resources/generator/client/angular/security/jwt/src/main/webapp/app/login/login.model.ts.mustache
+++ b/src/main/resources/generator/client/angular/security/jwt/src/main/webapp/app/login/login.model.ts.mustache
@@ -1,3 +1,6 @@
 export class Login {
-  constructor(public username: string | null, public password: string | null) {}
+  constructor(
+    public username: string | null,
+    public password: string | null,
+  ) {}
 }


Test patch:
diff --git a/src/test/java/tech/jhipster/lite/generator/client/angular/security/oauth2/domain/AngularOauth2ModuleFactoryTest.java b/src/test/java/tech/jhipster/lite/generator/client/angular/security/oauth2/domain/AngularOauth2ModuleFactoryTest.java
index 17cb94042..1334687bf 100644
--- a/src/test/java/tech/jhipster/lite/generator/client/angular/security/oauth2/domain/AngularOauth2ModuleFactoryTest.java
+++ b/src/test/java/tech/jhipster/lite/generator/client/angular/security/oauth2/domain/AngularOauth2ModuleFactoryTest.java
@@ -61,7 +61,7 @@ class AngularOauth2ModuleFactoryTest {
           keycloak: {
             url: 'http://localhost:9080',
             realm: 'jhipster',
-            client_id: 'web_app'
+            client_id: 'web_app',
           },
         """
       )
@@ -72,7 +72,7 @@ class AngularOauth2ModuleFactoryTest {
           keycloak: {
             url: 'http://localhost:9080',
             realm: 'jhipster',
-            client_id: 'web_app'
+            client_id: 'web_app',
           },
         """
       )