From 517c7099c79c047b33f2ada16081cb4b6a32e98f Mon Sep 17 00:00:00 2001 From: Christoph Zwerschke Date: Mon, 2 Dec 2024 14:27:06 +0000 Subject: [PATCH] Fix linter issue --- eslint.config.js | 1 + src/app/app.component.ts | 12 ++++-------- .../features/site-header/site-header.component.ts | 14 ++++++++------ 3 files changed, 13 insertions(+), 14 deletions(-) diff --git a/eslint.config.js b/eslint.config.js index cd2bef4..e232f51 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -50,6 +50,7 @@ export default [ 'jsdoc/require-jsdoc': [ 'warn', { + exemptEmptyConstructors: true, require: { FunctionDeclaration: true, MethodDefinition: true, diff --git a/src/app/app.component.ts b/src/app/app.component.ts index 7e631a3..a674ee6 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -1,4 +1,4 @@ -import { Component, OnInit } from '@angular/core'; +import { Component, inject, OnInit } from '@angular/core'; import { MatIconRegistry } from '@angular/material/icon'; import { RouterOutlet } from '@angular/router'; import { ShowSessionComponent } from '@app/portal/features/show-session/show-session.component'; @@ -19,16 +19,12 @@ import { SiteHeaderComponent } from '@app/portal/features/site-header/site-heade templateUrl: './app.component.html', }) export class AppComponent implements OnInit { - /** - * Creating new instance of MatIconRegistry - * @param matIconReg - */ - constructor(private matIconReg: MatIconRegistry) {} + #matIconReg = inject(MatIconRegistry); /** - * Run on App component initialisation + * Run on App component initialization */ ngOnInit(): void { - this.matIconReg.setDefaultFontSetClass('material-symbols-outlined'); + this.#matIconReg.setDefaultFontSetClass('material-symbols-outlined'); } } diff --git a/src/app/portal/features/site-header/site-header.component.ts b/src/app/portal/features/site-header/site-header.component.ts index fb6bf30..0c29cf8 100644 --- a/src/app/portal/features/site-header/site-header.component.ts +++ b/src/app/portal/features/site-header/site-header.component.ts @@ -17,17 +17,19 @@ import { AuthService } from '@app/auth/services/auth.service'; styleUrl: './site-header.component.scss', }) export class SiteHeaderComponent { + #router = inject(Router); + #authService = inject(AuthService); + isLoggedIn = this.#authService.isLoggedIn; + route: string = ''; - constructor(private router: Router) { - this.router.events.subscribe((event) => { + + constructor() { + this.#router.events.subscribe((event) => { if (event instanceof NavigationEnd) { - this.route = this.router.url; + this.route = this.#router.url; } else return; }); } - #authService = inject(AuthService); - - isLoggedIn = this.#authService.isLoggedIn; /** * User login