From 696a30051be54fc5b36a34c09e2f76b272677c17 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 10 Feb 2026 02:35:24 +0000 Subject: [PATCH] Fix lint failures, console.* convention violations, and CI Node version mismatch - Add docs/capacitor-native-app-plan.md to hex-lint ignore list (code examples naturally reference hex colors in Capacitor config) - Replace direct console.error/console.log calls with logger utility in historyView.js, profileCache.js, EventDetailsModal.js, ZapInterface.js, and notificationController.js - Update CI workflow from Node 20 to Node 22 to match package.json engines https://claude.ai/code/session_01LzErpH9FNw4hAPsjoYb1v9 --- .github/workflows/ci.yml | 10 +++++----- js/historyView.js | 4 ++-- js/state/profileCache.js | 2 +- js/ui/components/EventDetailsModal.js | 5 +++-- js/ui/dm/ZapInterface.js | 3 ++- js/ui/notificationController.js | 6 ++++-- scripts/check-hex.js | 3 ++- 7 files changed, 19 insertions(+), 14 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 61f888f9..b6ce5e3f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,7 +16,7 @@ jobs: timeout-minutes: 45 strategy: matrix: - node-version: [20] + node-version: [22] steps: - name: Check out repository @@ -85,7 +85,7 @@ jobs: strategy: fail-fast: false matrix: - node-version: [20] + node-version: [22] shard: [1, 2, 3] steps: @@ -128,7 +128,7 @@ jobs: timeout-minutes: 20 strategy: matrix: - node-version: [20] + node-version: [22] steps: - name: Check out repository @@ -168,7 +168,7 @@ jobs: timeout-minutes: 30 strategy: matrix: - node-version: [20] + node-version: [22] steps: - name: Check out repository @@ -208,7 +208,7 @@ jobs: timeout-minutes: 45 strategy: matrix: - node-version: [20] + node-version: [22] steps: - name: Check out repository diff --git a/js/historyView.js b/js/historyView.js index 4adda743..3e052fa4 100644 --- a/js/historyView.js +++ b/js/historyView.js @@ -2154,7 +2154,7 @@ export function createWatchHistoryRenderer(config = {}) { if (typeof app?.showSuccess === "function") { app.showSuccess("Local watch history reset."); } else { - console.log("Local watch history reset."); + userLogger.info("[historyView] Local watch history reset."); } } catch (error) { const message = @@ -2165,7 +2165,7 @@ export function createWatchHistoryRenderer(config = {}) { if (typeof app?.showError === "function") { app.showError(message); } else { - console.error(message); + userLogger.error("[historyView]", message); } } }; diff --git a/js/state/profileCache.js b/js/state/profileCache.js index 14317b8b..8c13d1ae 100644 --- a/js/state/profileCache.js +++ b/js/state/profileCache.js @@ -414,7 +414,7 @@ class ProfileCache { try { listener(event, detail); } catch (error) { - console.error("[ProfileCache] Listener error", error); + userLogger.error("[ProfileCache] Listener error", error); } } } diff --git a/js/ui/components/EventDetailsModal.js b/js/ui/components/EventDetailsModal.js index c8c35dd2..56e10dc4 100644 --- a/js/ui/components/EventDetailsModal.js +++ b/js/ui/components/EventDetailsModal.js @@ -1,5 +1,6 @@ import { prepareStaticModal, openStaticModal, closeStaticModal } from "./staticModalAccessibility.js"; import { sanitizeProfileMediaUrl } from "../../utils/profileMedia.js"; +import { devLogger } from "../../utils/logger.js"; const DEFAULT_PROFILE_AVATAR = "assets/svg/default-profile.svg"; @@ -334,7 +335,7 @@ export class EventDetailsModal { } }) .catch((error) => { - console.error( + devLogger.error( "[EventDetailsModal] Failed to fetch raw event:", error, ); @@ -441,7 +442,7 @@ export class EventDetailsModal { } } } catch (e) { - console.error("Failed to load history", e); + devLogger.error("[EventDetailsModal] Failed to load history", e); } finally { this.isLoadingHistory = false; this.updateNavigationState(); diff --git a/js/ui/dm/ZapInterface.js b/js/ui/dm/ZapInterface.js index eb3a3ed6..dd54bb30 100644 --- a/js/ui/dm/ZapInterface.js +++ b/js/ui/dm/ZapInterface.js @@ -1,5 +1,6 @@ import { ZapReceiptList } from "./ZapReceiptList.js"; import { createAndPublishZapRequest, resolveZapRecipient } from "../../payments/zapRequests.js"; +import { userLogger } from "../../utils/logger.js"; function createElement(doc, tag, className, text) { const element = doc.createElement(tag); @@ -91,7 +92,7 @@ export function createZapInterface(doc, { contact, zapReceipts, onSendZap, zapCo throw new Error("No signer available"); } } catch (err) { - console.error(err); + userLogger.error("[ZapInterface] Failed to send zap:", err); statusDiv.textContent = "Failed to send zap"; statusDiv.className = "text-error text-xs text-center mt-1"; } finally { diff --git a/js/ui/notificationController.js b/js/ui/notificationController.js index 9b1d6d2f..5e86b8e0 100644 --- a/js/ui/notificationController.js +++ b/js/ui/notificationController.js @@ -1,3 +1,5 @@ +import { userLogger as _fallbackUserLogger, devLogger as _fallbackDevLogger } from "../utils/logger.js"; + export default class NotificationController { constructor({ portal, @@ -16,8 +18,8 @@ export default class NotificationController { this.statusContainer?.querySelector("[data-status-message]") || null; // Fallback loggers if not provided - this.userLogger = loggers.userLogger || { error: console.error, warn: console.warn, log: console.log, info: console.info }; - this.devLogger = loggers.devLogger || { error: console.error, warn: console.warn, log: console.log, info: console.info }; + this.userLogger = loggers.userLogger || _fallbackUserLogger; + this.devLogger = loggers.devLogger || _fallbackDevLogger; this.document = documentRef; this.window = windowRef; diff --git a/scripts/check-hex.js b/scripts/check-hex.js index 226d2a56..ee1a56b3 100755 --- a/scripts/check-hex.js +++ b/scripts/check-hex.js @@ -34,7 +34,8 @@ const IGNORED_GLOBS = [ '**/*.ai', 'releases/**', 'bitvid-working-webtorrent/**', - 'scripts/agent/**' + 'scripts/agent/**', + 'docs/capacitor-native-app-plan.md' ]; const gitArgs = [