From cf6b5b691a011825ca6233c8ac389e40637fb851 Mon Sep 17 00:00:00 2001 From: 4gray Date: Fri, 21 May 2021 11:12:02 +0200 Subject: [PATCH] refactor: resolve eslint issues --- api.ts | 31 ++++----------------- src/app/home/home.component.ts | 4 +-- src/app/settings/settings.component.spec.ts | 2 +- 3 files changed, 9 insertions(+), 28 deletions(-) diff --git a/api.ts b/api.ts index a5a7b394d..b8586e776 100644 --- a/api.ts +++ b/api.ts @@ -293,7 +293,7 @@ export class Api { */ createPlaylistObject( name: string, - playlist: any, + playlist: ParsedPlaylist, urlOrPath?: string, uploadType?: 'URL' | 'FILE' ): Playlist { @@ -319,26 +319,6 @@ export class Api { }; } - saveUpdatedPlaylist( - id: string, - playlist: any - ): Promise<{ - numAffected: number; - upsert: boolean; - }> { - return db.update( - { _id: id }, - { - $set: { - playlist, - count: playlist.items.length, - updateDate: Date.now(), - updateState: PlaylistUpdateState.UPDATED, - }, - } - ); - } - /** * Updates the provided playlist in the database * @param id id of the playlist @@ -368,7 +348,7 @@ export class Api { */ async handlePlaylistRefresh( id: string, - playlistString: any, + playlistString: string, event?: Electron.IpcMainEvent ): Promise { const playlist: ParsedPlaylist = @@ -449,6 +429,7 @@ export class Api { /** * Sends an error message to the renderer process * @param error + * @param id * @param event */ handleFileNotFoundError( @@ -460,7 +441,7 @@ export class Api { }, id: string, event?: Electron.IpcMainEvent - ) { + ): void { console.error(error); this.updatePlaylistById(id, { updateState: PlaylistUpdateState.NOT_UPDATED, @@ -475,7 +456,7 @@ export class Api { } } - convertFileStringToPlaylist(m3uString: string): any { + convertFileStringToPlaylist(m3uString: string): ParsedPlaylist { return this.parsePlaylist(m3uString.split('\n')); } @@ -483,7 +464,7 @@ export class Api { * Parses string based array to playlist object * @param m3uArray m3u playlist as array with strings */ - parsePlaylist(m3uArray: any[]): any { + parsePlaylist(m3uArray: string[]): ParsedPlaylist { const playlistAsString = m3uArray.join('\n'); return parse(playlistAsString); } diff --git a/src/app/home/home.component.ts b/src/app/home/home.component.ts index f201b1321..380237d0c 100644 --- a/src/app/home/home.component.ts +++ b/src/app/home/home.component.ts @@ -42,7 +42,7 @@ export class HomeComponent { commandsList = [ { id: PLAYLIST_PARSE_RESPONSE, - execute: (response: { payload: Playlist }) => + execute: (response: { payload: Playlist }): void => this.setPlaylist(response.payload), }, { @@ -71,7 +71,7 @@ export class HomeComponent { }, { id: PLAYLIST_UPDATE_RESPONSE, - execute: (response: { message: string }) => + execute: (response: { message: string }): void => this.showNotification(response.message), }, ]; diff --git a/src/app/settings/settings.component.spec.ts b/src/app/settings/settings.component.spec.ts index 7d167f287..2a8e6ff99 100644 --- a/src/app/settings/settings.component.spec.ts +++ b/src/app/settings/settings.component.spec.ts @@ -27,7 +27,7 @@ class MatSnackBarStub { } export class MockRouter { - navigateByUrl(url: string) { + navigateByUrl(url: string): string { return url; } }