From 00a2d778c047cf67b844898e090b9c9c3ccf64dd Mon Sep 17 00:00:00 2001 From: "aditya.chandel" <> Date: Sun, 12 Jan 2025 20:30:21 -0700 Subject: [PATCH] Lint fixes --- booklore-ui/src/app/app.component.ts | 2 +- .../components/book-browser/book-browser.component.ts | 2 +- .../book-browser/book-table/book-table.component.ts | 4 ++-- .../components/shelf-assigner/shelf-assigner.component.ts | 4 ++-- .../component/layout-main/service/app.layout.service.ts | 6 +++--- .../component/layout-menu/app.menuitem.component.ts | 2 +- .../theme-configurator/theme-configurator.component.ts | 8 +++----- .../metadata-picker/metadata-picker.component.ts | 4 ++-- .../metadata/model/book-metadata-for-book-info.model.ts | 4 ++-- 9 files changed, 17 insertions(+), 19 deletions(-) diff --git a/booklore-ui/src/app/app.component.ts b/booklore-ui/src/app/app.component.ts index a03bdae15..6f1bca2af 100644 --- a/booklore-ui/src/app/app.component.ts +++ b/booklore-ui/src/app/app.component.ts @@ -33,7 +33,7 @@ export class AppComponent implements OnInit { }); this.rxStompService.watch('/topic/log').subscribe((message: Message) => { - let logNotification = parseLogNotification(message.body); + const logNotification = parseLogNotification(message.body); this.eventService.handleIncomingLog(logNotification); }); } diff --git a/booklore-ui/src/app/book/components/book-browser/book-browser.component.ts b/booklore-ui/src/app/book/components/book-browser/book-browser.component.ts index 24ec9b2c3..83626d47f 100644 --- a/booklore-ui/src/app/book/components/book-browser/book-browser.component.ts +++ b/booklore-ui/src/app/book/components/book-browser/book-browser.component.ts @@ -84,7 +84,7 @@ export class BookBrowserComponent implements OnInit { entityType: EntityType | undefined; bookTitle: string = ''; entityOptions: MenuItem[] | undefined; - selectedBooks: Set = new Set(); + selectedBooks = new Set(); selectedSort: SortOption | null = null; sortOptions: SortOption[] = []; isDrawerVisible: boolean = false; diff --git a/booklore-ui/src/app/book/components/book-browser/book-table/book-table.component.ts b/booklore-ui/src/app/book/components/book-browser/book-table/book-table.component.ts index 56f69fa88..66820595f 100644 --- a/booklore-ui/src/app/book/components/book-browser/book-table/book-table.component.ts +++ b/booklore-ui/src/app/book/components/book-browser/book-table/book-table.component.ts @@ -23,7 +23,7 @@ import {SortOption} from '../../../model/sort.model'; }) export class BookTableComponent implements OnChanges { selectedBooks: Book[] = []; - selectedBookIds: Set = new Set(); + selectedBookIds = new Set(); @Output() selectedBooksChange = new EventEmitter>(); @Input() books: Book[] = []; @@ -34,7 +34,7 @@ export class BookTableComponent implements OnChanges { // Hack to set virtual-scroller height ngOnChanges() { - let wrapperElements: HTMLCollection = document.getElementsByClassName('p-virtualscroller'); + const wrapperElements: HTMLCollection = document.getElementsByClassName('p-virtualscroller'); Array.prototype.forEach.call(wrapperElements, function (wrapperElement) { wrapperElement.style["height"] = 'calc(100vh - 160px)'; }); diff --git a/booklore-ui/src/app/book/components/shelf-assigner/shelf-assigner.component.ts b/booklore-ui/src/app/book/components/shelf-assigner/shelf-assigner.component.ts index f12fd28a0..f595e688b 100644 --- a/booklore-ui/src/app/book/components/shelf-assigner/shelf-assigner.component.ts +++ b/booklore-ui/src/app/book/components/shelf-assigner/shelf-assigner.component.ts @@ -42,7 +42,7 @@ export class ShelfAssignerComponent implements OnInit { selectedShelves: Shelf[] = []; displayShelfDialog: boolean = false; shelfName: string = ''; - bookIds: Set = new Set(); + bookIds = new Set(); isMultiBooks: boolean = false; selectedIcon: string | null = null; @@ -92,7 +92,7 @@ export class ShelfAssignerComponent implements OnInit { } updateBooksShelves(): void { - const idsToAssign: Set = new Set(this.selectedShelves.map(shelf => shelf.id)); + const idsToAssign = new Set(this.selectedShelves.map(shelf => shelf.id)); const idsToUnassign: Set = this.isMultiBooks ? new Set() : this.getIdsToUnAssign(this.book, idsToAssign); const bookIds = this.isMultiBooks ? this.bookIds : new Set([this.book.id]); this.updateBookShelves(bookIds, idsToAssign, idsToUnassign); diff --git a/booklore-ui/src/app/layout/component/layout-main/service/app.layout.service.ts b/booklore-ui/src/app/layout/component/layout-main/service/app.layout.service.ts index 97f251a81..87672abb0 100644 --- a/booklore-ui/src/app/layout/component/layout-main/service/app.layout.service.ts +++ b/booklore-ui/src/app/layout/component/layout-main/service/app.layout.service.ts @@ -105,7 +105,7 @@ export class LayoutService { changeTheme() { const config = this.config(); - const themeLink = document.getElementById('theme-css'); + const themeLink = document.getElementById('theme-css') as HTMLLinkElement; const themeLinkHref = themeLink.getAttribute('href')!; const newHref = themeLinkHref .split('/') @@ -122,8 +122,8 @@ export class LayoutService { } replaceThemeLink(href: string) { const id = 'theme-css'; - let themeLink = document.getElementById(id); - const cloneLinkElement = themeLink.cloneNode(true); + const themeLink = document.getElementById(id) as HTMLLinkElement; + const cloneLinkElement = themeLink.cloneNode(true) as HTMLLinkElement; cloneLinkElement.setAttribute('href', href); cloneLinkElement.setAttribute('id', id + '-clone'); diff --git a/booklore-ui/src/app/layout/component/layout-menu/app.menuitem.component.ts b/booklore-ui/src/app/layout/component/layout-menu/app.menuitem.component.ts index 5ddb6f397..5a0f95ec4 100644 --- a/booklore-ui/src/app/layout/component/layout-menu/app.menuitem.component.ts +++ b/booklore-ui/src/app/layout/component/layout-menu/app.menuitem.component.ts @@ -116,7 +116,7 @@ export class AppMenuitemComponent implements OnInit, OnDestroy { } updateActiveStateFromRoute() { - let activeRoute = this.router.isActive(this.item.routerLink[0], { + const activeRoute = this.router.isActive(this.item.routerLink[0], { paths: 'exact', queryParams: 'ignored', matrixParams: 'ignored', diff --git a/booklore-ui/src/app/layout/component/theme-configurator/theme-configurator.component.ts b/booklore-ui/src/app/layout/component/theme-configurator/theme-configurator.component.ts index 41340b4b0..64f959a7e 100644 --- a/booklore-ui/src/app/layout/component/theme-configurator/theme-configurator.component.ts +++ b/booklore-ui/src/app/layout/component/theme-configurator/theme-configurator.component.ts @@ -1,5 +1,5 @@ import {CommonModule, isPlatformBrowser} from '@angular/common'; -import {Component, computed, inject, PLATFORM_ID} from '@angular/core'; +import {Component, computed, inject, PLATFORM_ID, OnInit} from '@angular/core'; import {FormsModule} from '@angular/forms'; import {$t, updatePreset, updateSurfacePalette} from '@primeng/themes'; import Aura from '@primeng/themes/aura'; @@ -14,9 +14,7 @@ import {SelectButton} from 'primeng/selectbutton'; import {ToggleSwitchModule} from 'primeng/toggleswitch'; import {AppConfigService} from '../../../core/service/app-config.service'; -interface ColorPalette { - [key: string]: string; -} +type ColorPalette = Record; interface Palette { name: string; @@ -39,7 +37,7 @@ const presets = { }, imports: [CommonModule, FormsModule, InputSwitchModule, ButtonModule, RadioButtonModule, SelectButton, ToggleSwitchModule] }) -export class ThemeConfiguratorComponent { +export class ThemeConfiguratorComponent implements OnInit { get ripple() { return this.config.ripple(); diff --git a/booklore-ui/src/app/metadata/book-metadata-center/metadata-picker/metadata-picker.component.ts b/booklore-ui/src/app/metadata/book-metadata-center/metadata-picker/metadata-picker.component.ts index a6b63ebd2..cf11f8e76 100644 --- a/booklore-ui/src/app/metadata/book-metadata-center/metadata-picker/metadata-picker.component.ts +++ b/booklore-ui/src/app/metadata/book-metadata-center/metadata-picker/metadata-picker.component.ts @@ -40,8 +40,8 @@ export class MetadataPickerComponent implements OnInit { currentBookId!: number; updateThumbnailUrl: boolean = false; thumbnailSaved: boolean = false; - copiedFields: { [key: string]: boolean } = {}; - savedFields: { [key: string]: boolean } = {}; + copiedFields: Record = {}; + savedFields: Record = {}; constructor(private bookService: BookService, private bookInfoService: BookMetadataCenterService, diff --git a/booklore-ui/src/app/metadata/model/book-metadata-for-book-info.model.ts b/booklore-ui/src/app/metadata/model/book-metadata-for-book-info.model.ts index 89a5b6173..14278ca29 100644 --- a/booklore-ui/src/app/metadata/model/book-metadata-for-book-info.model.ts +++ b/booklore-ui/src/app/metadata/model/book-metadata-for-book-info.model.ts @@ -2,8 +2,8 @@ export interface BookMetadataBI { bookId: number; title: string; subtitle?: string; - authors: Array; - categories: Array; + authors: string[]; + categories: string[]; publisher: string; publishedDate: string; isbn10: string;