From 5dcc688577d157ac3214914fc8d1b0de00714908 Mon Sep 17 00:00:00 2001 From: Julien Maille Date: Sun, 18 Jan 2026 23:28:58 +0100 Subject: [PATCH] style: fix all linting warnings (unused vars/imports) --- js/events.js | 1 - js/lastfm.js | 8 +++----- js/lyrics.js | 10 +++------- js/settings.js | 2 +- js/ui.js | 6 ++---- 5 files changed, 9 insertions(+), 18 deletions(-) diff --git a/js/events.js b/js/events.js index 48b5859..e671da7 100644 --- a/js/events.js +++ b/js/events.js @@ -8,7 +8,6 @@ import { trackDataStore, formatTime, SVG_BIN, - escapeHtml, } from './utils.js'; import { lastFMStorage, waveformSettings } from './storage.js'; import { showNotification, downloadTrackWithMetadata } from './downloads.js'; diff --git a/js/lastfm.js b/js/lastfm.js index f07f6ab..45a13bf 100644 --- a/js/lastfm.js +++ b/js/lastfm.js @@ -1,6 +1,4 @@ //js/lastfm.js -import { delay, getTrackArtists } from './utils.js'; - export class LastFMScrobbler { constructor() { this.API_KEY = '0ecf01914957b40c17030db822845a76'; @@ -25,8 +23,8 @@ export class LastFMScrobbler { this.sessionKey = data.key; this.username = data.name; } - } catch (e) { - console.error('Failed to load Last.fm session:', e); + } catch { + console.error('Failed to load Last.fm session'); } } @@ -66,7 +64,7 @@ export class LastFMScrobbler { try { const { default: md5 } = await import('https://cdn.jsdelivr.net/npm/md5@2.3.0/+esm'); return md5(signatureString); - } catch (e) { + } catch { console.error('MD5 library not available'); throw new Error('MD5 library required for Last.fm'); } diff --git a/js/lyrics.js b/js/lyrics.js index 175f9bc..4951239 100644 --- a/js/lyrics.js +++ b/js/lyrics.js @@ -1,11 +1,7 @@ //js/lyrics.js -import { getTrackTitle, getTrackArtists, buildTrackFilename, SVG_DOWNLOAD, SVG_CLOSE } from './utils.js'; +import { getTrackTitle, getTrackArtists, buildTrackFilename, SVG_CLOSE } from './utils.js'; import { sidePanelManager } from './side-panel.js'; -// Dictionary path for kuromoji -// Using CDN - the kuroshiro-analyzer loaded from unpkg will use this as base for fetching dict files -const KUROMOJI_DICT_PATH = 'https://cdn.jsdelivr.net/npm/kuromoji@0.1.2/dict/'; - export class LyricsManager { constructor(api) { this.api = api; @@ -190,7 +186,7 @@ export class LyricsManager { getRomajiMode() { try { return localStorage.getItem('lyricsRomajiMode') === 'true'; - } catch (e) { + } catch { return false; } } @@ -543,7 +539,7 @@ export function openLyricsPanel(track, audioPlayer, lyricsManager, forceOpen = f romajiBtn.addEventListener('click', async () => { const amLyrics = sidePanelManager.panel.querySelector('am-lyrics'); if (amLyrics) { - const newMode = await manager.toggleRomajiMode(amLyrics); + await manager.toggleRomajiMode(amLyrics); updateRomajiBtn(); } }); diff --git a/js/settings.js b/js/settings.js index ae122d3..74def68 100644 --- a/js/settings.js +++ b/js/settings.js @@ -587,7 +587,7 @@ export function initializeSettings(scrobbler, player, api, ui) { try { const fbConfig = JSON.parse(fbConfigStr); saveFirebaseConfig(fbConfig); - } catch (e) { + } catch { alert('Invalid JSON for Firebase Config'); return; } diff --git a/js/ui.js b/js/ui.js index db90c9e..5a7618c 100644 --- a/js/ui.js +++ b/js/ui.js @@ -17,7 +17,7 @@ import { escapeHtml, } from './utils.js'; import { openLyricsPanel } from './lyrics.js'; -import { recentActivityManager, backgroundSettings, trackListSettings, cardSettings } from './storage.js'; +import { recentActivityManager, backgroundSettings, cardSettings } from './storage.js'; import { db } from './db.js'; import { getVibrantColorFromImage } from './vibrant-color.js'; import { syncManager } from './accounts/pocketbase.js'; @@ -70,7 +70,7 @@ export class UIRenderer { this.vibrantColorCache.set(url, null); this.resetVibrantColor(); } - } catch (e) { + } catch { this.vibrantColorCache.set(url, null); this.resetVibrantColor(); } @@ -163,7 +163,6 @@ export class UIRenderer { } createTrackItemHTML(track, index, showCover = false, hasMultipleDiscs = false) { - const playIconSmall = SVG_PLAY; const trackImageHTML = showCover ? `Track Cover` : ''; @@ -630,7 +629,6 @@ export class UIRenderer { const title = document.getElementById('fullscreen-track-title'); const artist = document.getElementById('fullscreen-track-artist'); const nextTrackEl = document.getElementById('fullscreen-next-track'); - const lyricsContainer = document.getElementById('fullscreen-lyrics-container'); const lyricsToggleBtn = document.getElementById('toggle-fullscreen-lyrics-btn'); const coverUrl = this.api.getCoverUrl(track.album?.cover, '1280');