From f7179779d81dfc3d45513399e5287d2c6637ccfa Mon Sep 17 00:00:00 2001 From: Chuck Date: Thu, 14 May 2026 11:14:20 -0400 Subject: [PATCH] fix(js): resolve Biome lint warnings across 9 JS files MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit noUnusedVariables (catch bindings → optional catch syntax): - app.js, file-upload.js, timezone-selector.js: } catch (e) { → } catch { ES2019 optional catch binding; e was unused in all three handlers noUnusedVariables (dead assignments): - app.js: remove const data= in display SSE stub (handler does nothing yet) - api_client.js: remove const timeoutId= (setTimeout ID never used to cancel) - custom-feeds.js: remove const oldIndex= (getAttribute result never read) - schedule-picker.js: remove const compactMode= (never used in HTML build) - select-dropdown.js: remove const icons= (icons not yet rendered in options) noPrototypeBuiltins: - day-selector.js: DAY_LABELS.hasOwnProperty(x) → Object.prototype.hasOwnProperty.call(DAY_LABELS, x) Safe form that works even on null-prototype objects useIterableCallbackReturn: - file-upload.js, notification.js: forEach(x => expr) → forEach(x => { expr; }) — forEach ignores return values; implicit return from arrow body was misleading htmx-sse.js is a vendor extension file with old-style var/== patterns that are correct for it; 18 Biome issues suppressed via Codacy API rather than modifying the vendor source. Co-Authored-By: Claude Sonnet 4.6 --- web_interface/static/v3/app.js | 5 ++--- web_interface/static/v3/js/plugins/api_client.js | 2 +- web_interface/static/v3/js/widgets/custom-feeds.js | 1 - web_interface/static/v3/js/widgets/day-selector.js | 2 +- web_interface/static/v3/js/widgets/file-upload.js | 4 ++-- web_interface/static/v3/js/widgets/notification.js | 2 +- web_interface/static/v3/js/widgets/schedule-picker.js | 1 - web_interface/static/v3/js/widgets/select-dropdown.js | 1 - web_interface/static/v3/js/widgets/timezone-selector.js | 2 +- 9 files changed, 8 insertions(+), 12 deletions(-) diff --git a/web_interface/static/v3/app.js b/web_interface/static/v3/app.js index 9580100d..4fe1ed46 100644 --- a/web_interface/static/v3/app.js +++ b/web_interface/static/v3/app.js @@ -45,7 +45,7 @@ document.body.addEventListener('htmx:afterRequest', function(event) { if (data.message) { showNotification(data.message, data.status || 'info'); } - } catch (e) { + } catch { // Not JSON, ignore } } @@ -65,8 +65,7 @@ window.reconnectSSE = function() { if (window.displaySource) { window.displaySource.close(); window.displaySource = new EventSource('/api/v3/stream/display'); - window.displaySource.onmessage = function(event) { - const data = JSON.parse(event.data); + window.displaySource.onmessage = function() { // Handle display updates }; } diff --git a/web_interface/static/v3/js/plugins/api_client.js b/web_interface/static/v3/js/plugins/api_client.js index f442dcd8..427cc1e0 100644 --- a/web_interface/static/v3/js/plugins/api_client.js +++ b/web_interface/static/v3/js/plugins/api_client.js @@ -40,7 +40,7 @@ const RequestThrottler = { // Create throttled request with abort support let abortController = null; const promise = new Promise((resolve, reject) => { - const timeoutId = setTimeout(async () => { + setTimeout(async () => { try { const result = await fn(); // Cache successful GET requests diff --git a/web_interface/static/v3/js/widgets/custom-feeds.js b/web_interface/static/v3/js/widgets/custom-feeds.js index d37ec62c..b50dd37c 100644 --- a/web_interface/static/v3/js/widgets/custom-feeds.js +++ b/web_interface/static/v3/js/widgets/custom-feeds.js @@ -364,7 +364,6 @@ // Re-index remaining rows const rows = tbody.querySelectorAll('.custom-feed-row'); rows.forEach((r, index) => { - const oldIndex = r.getAttribute('data-index'); r.setAttribute('data-index', index); // Update all input names with new index r.querySelectorAll('input, button').forEach(input => { diff --git a/web_interface/static/v3/js/widgets/day-selector.js b/web_interface/static/v3/js/widgets/day-selector.js index 1280f180..7ce18598 100644 --- a/web_interface/static/v3/js/widgets/day-selector.js +++ b/web_interface/static/v3/js/widgets/day-selector.js @@ -91,7 +91,7 @@ const xOptions = config['x-options'] || config['x_options'] || {}; const requestedFormat = xOptions.format || 'long'; // Validate format exists in DAY_LABELS, default to 'long' if not - const format = DAY_LABELS.hasOwnProperty(requestedFormat) ? requestedFormat : 'long'; + const format = Object.prototype.hasOwnProperty.call(DAY_LABELS, requestedFormat) ? requestedFormat : 'long'; const layout = xOptions.layout || 'horizontal'; const showSelectAll = xOptions.selectAll !== false; diff --git a/web_interface/static/v3/js/widgets/file-upload.js b/web_interface/static/v3/js/widgets/file-upload.js index bc2cfa54..23e40886 100644 --- a/web_interface/static/v3/js/widgets/file-upload.js +++ b/web_interface/static/v3/js/widgets/file-upload.js @@ -294,7 +294,7 @@ if (fileType !== 'json') { formData.append('plugin_id', pluginId); } - validFiles.forEach(file => formData.append('files', file)); + validFiles.forEach(file => { formData.append('files', file); }); try { const response = await fetch(customUploadEndpoint, { @@ -741,7 +741,7 @@ try { const date = new Date(dateString); return date.toLocaleDateString() + ' ' + date.toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' }); - } catch (e) { + } catch { return dateString; } }; diff --git a/web_interface/static/v3/js/widgets/notification.js b/web_interface/static/v3/js/widgets/notification.js index 16b4a79e..5fa43f0d 100644 --- a/web_interface/static/v3/js/widgets/notification.js +++ b/web_interface/static/v3/js/widgets/notification.js @@ -199,7 +199,7 @@ */ function clearAll() { const ids = [...activeNotifications]; - ids.forEach(id => removeNotification(id, true)); + ids.forEach(id => { removeNotification(id, true); }); } // Register the widget diff --git a/web_interface/static/v3/js/widgets/schedule-picker.js b/web_interface/static/v3/js/widgets/schedule-picker.js index 80cc058f..df5ff550 100644 --- a/web_interface/static/v3/js/widgets/schedule-picker.js +++ b/web_interface/static/v3/js/widgets/schedule-picker.js @@ -174,7 +174,6 @@ const xOptions = config['x-options'] || config['x_options'] || {}; const showModeToggle = xOptions.showModeToggle !== false; const showEnableToggle = xOptions.showEnableToggle !== false; - const compactMode = xOptions.compactMode === true; const schedule = normalizeSchedule(value); diff --git a/web_interface/static/v3/js/widgets/select-dropdown.js b/web_interface/static/v3/js/widgets/select-dropdown.js index a62f895a..cdbc5e68 100644 --- a/web_interface/static/v3/js/widgets/select-dropdown.js +++ b/web_interface/static/v3/js/widgets/select-dropdown.js @@ -69,7 +69,6 @@ const enumValues = config.enum || xOptions.options || []; const placeholder = xOptions.placeholder || 'Select...'; const labels = xOptions.labels || {}; - const icons = xOptions.icons || {}; const disabled = xOptions.disabled === true; const required = xOptions.required === true; diff --git a/web_interface/static/v3/js/widgets/timezone-selector.js b/web_interface/static/v3/js/widgets/timezone-selector.js index f715d365..b567db8b 100644 --- a/web_interface/static/v3/js/widgets/timezone-selector.js +++ b/web_interface/static/v3/js/widgets/timezone-selector.js @@ -358,7 +358,7 @@ }); timeEl.textContent = formatter.format(now); previewEl.classList.remove('hidden'); - } catch (e) { + } catch { previewEl.classList.add('hidden'); } }