From ce8d2318a1a6fa2da96f9ca9fe3b0dccab4bcdee Mon Sep 17 00:00:00 2001 From: Sieciech Date: Mon, 30 Aug 2021 17:30:40 +0200 Subject: [PATCH] fix lint --- src/frontend/src/app/app.component.ts | 9 ++------- src/frontend/src/app/modules/auth/models/user.model.ts | 2 +- .../profile-edit-basics/profile-edit-basics.component.ts | 7 +++---- .../components/profile-edit/profile-edit.component.ts | 4 ++-- .../error-handler/error-handler.interceptor.ts | 8 ++++---- .../modules/shared/notification/notification.service.ts | 8 ++++---- 6 files changed, 16 insertions(+), 22 deletions(-) diff --git a/src/frontend/src/app/app.component.ts b/src/frontend/src/app/app.component.ts index b66cba9..05945dd 100644 --- a/src/frontend/src/app/app.component.ts +++ b/src/frontend/src/app/app.component.ts @@ -29,7 +29,6 @@ export class AppComponent implements AfterContentInit { appRoutes = appRoutes; user: UserModel; loaded = false; - //isSidebarHidden = false; dynamicToolbarComponents = []; roles: UserRoleEnum[] = [ UserRoleEnum.None ]; @@ -53,7 +52,7 @@ export class AppComponent implements AfterContentInit { ) { } - ngAfterContentInit () { + ngAfterContentInit(): void { this.configureResizeEvents(); this.configureUserEvents(); this.configureSidebarEvents(); @@ -68,7 +67,7 @@ export class AppComponent implements AfterContentInit { this.authService.userChange.subscribe(user => this.setUser(user)); } - setUser(user: UserModel) { + setUser(user: UserModel): void { console.log({user, cuser: this.user}); if (!user && !this.user) { return; @@ -87,10 +86,6 @@ export class AppComponent implements AfterContentInit { } configureSidebarEvents(): void { - //this.isSidebarHidden = this.appService.getSidebarHidden(); - //this.appService.sidebarHiddenChange.subscribe(hidden => { - // this.isSidebarHidden = hidden; - //}); const sidebarUserPrefference = this.browserStorageService.getItem('sidebar.open'); if (sidebarUserPrefference !== null) { this.sidebarOpen = sidebarUserPrefference; diff --git a/src/frontend/src/app/modules/auth/models/user.model.ts b/src/frontend/src/app/modules/auth/models/user.model.ts index 3e06286..4f33d3e 100644 --- a/src/frontend/src/app/modules/auth/models/user.model.ts +++ b/src/frontend/src/app/modules/auth/models/user.model.ts @@ -1,4 +1,4 @@ -import { UserRoleEnum } from "../enums/user-role.enum"; +import { UserRoleEnum } from '../enums/user-role.enum'; export interface UserModel { id: number; diff --git a/src/frontend/src/app/modules/profile/components/profile-edit-basics/profile-edit-basics.component.ts b/src/frontend/src/app/modules/profile/components/profile-edit-basics/profile-edit-basics.component.ts index 1d7a6bc..7a83799 100644 --- a/src/frontend/src/app/modules/profile/components/profile-edit-basics/profile-edit-basics.component.ts +++ b/src/frontend/src/app/modules/profile/components/profile-edit-basics/profile-edit-basics.component.ts @@ -67,7 +67,6 @@ export class ProfileEditBasicsComponent implements OnInit { phones, emails, }); - window['form'] = this.form; this.countryService.getCountries().subscribe(countries => { this.countries = countries; @@ -90,7 +89,7 @@ export class ProfileEditBasicsComponent implements OnInit { ngOnInit(): void { } - scroll(e) { + scroll(e): void { const scrollTop = e.target?.scrollTop; if (Number(scrollTop) === scrollTop) { this.placeholderBoxHeight = Math.min(scrollTop, this.headerHeight); @@ -98,11 +97,11 @@ export class ProfileEditBasicsComponent implements OnInit { } } - filterCountries(name: string) { + filterCountries(name: string): CountryModel[] { return this.countries.filter(i => i.name.toLowerCase().includes(name)); } - countryFieldChanged(event) { + countryFieldChanged(event): void { this.countryInput = event.target.value.toLowerCase(); this.countryInputChnage.next(this.countryInput); } diff --git a/src/frontend/src/app/modules/profile/components/profile-edit/profile-edit.component.ts b/src/frontend/src/app/modules/profile/components/profile-edit/profile-edit.component.ts index 46c234b..ee4b709 100644 --- a/src/frontend/src/app/modules/profile/components/profile-edit/profile-edit.component.ts +++ b/src/frontend/src/app/modules/profile/components/profile-edit/profile-edit.component.ts @@ -79,7 +79,7 @@ export class ProfileEditComponent implements OnInit { ngOnInit(): void { } - activated(component) { + activated(component): void { if (component.onContentScroll) { component.headerHeight = this.headerContent.nativeElement.scrollHeight; setTimeout(() => { @@ -93,7 +93,7 @@ export class ProfileEditComponent implements OnInit { } } - deactivated(component) { + deactivated(component): void { this.scrolled = 0; this.scrollSubscriptions.forEach(i => i.unsubscribe()); this.scrollSubscriptions = []; diff --git a/src/frontend/src/app/modules/shared/interceptors/error-handler/error-handler.interceptor.ts b/src/frontend/src/app/modules/shared/interceptors/error-handler/error-handler.interceptor.ts index 67f6cc1..362eb44 100644 --- a/src/frontend/src/app/modules/shared/interceptors/error-handler/error-handler.interceptor.ts +++ b/src/frontend/src/app/modules/shared/interceptors/error-handler/error-handler.interceptor.ts @@ -7,7 +7,7 @@ import { NotificationService } from '../../notification/notification.service'; @Injectable() export class ErrorHandlerInterceptor implements HttpInterceptor { - get notificationService() { + get notificationService():. NotificationService { return this.injector.get(NotificationService); } @@ -19,7 +19,7 @@ export class ErrorHandlerInterceptor implements HttpInterceptor { intercept(httpRequest: HttpRequest, next: HttpHandler): Observable> { return next.handle(httpRequest).pipe( catchError(response => { - switch(response.status) { + switch (response.status) { case 406: if (response.error instanceof Blob && response.error.type === 'application/json') { const result = new Promise((resolve) => { @@ -41,10 +41,10 @@ export class ErrorHandlerInterceptor implements HttpInterceptor { } return throwError(response); }) - ) + ); } - displayNotificationIfValidationError(response) { + displayNotificationIfValidationError(response): void { console.log({response}); if (response?.error?.data) { this.notificationService.error(response.error.data); diff --git a/src/frontend/src/app/modules/shared/notification/notification.service.ts b/src/frontend/src/app/modules/shared/notification/notification.service.ts index d24b106..dd640f2 100644 --- a/src/frontend/src/app/modules/shared/notification/notification.service.ts +++ b/src/frontend/src/app/modules/shared/notification/notification.service.ts @@ -12,10 +12,10 @@ export class NotificationService { constructor(private snackBar: MatSnackBar) { } - notify(type: NotificationType, title: string) { + notify(type: NotificationType, title: string): void { let action: string; let panelClass: string; - let duration = 1500000; + const duration = 1500000; switch (type) { case NotificationType.Success: @@ -35,11 +35,11 @@ export class NotificationService { }); } - success(title: string) { + success(title: string): void { return this.notify(NotificationType.Success, title); } - error(title: string) { + error(title: string): void { return this.notify(NotificationType.Error, title); }