From 8c0b547855758270aaed7e3978bc7fdba729df27 Mon Sep 17 00:00:00 2001 From: Matthew Raymer Date: Tue, 12 Aug 2025 09:12:46 +0000 Subject: [PATCH] fix(typescript): resolve production build errors and add ESLint ignore comments - Fix TypeScript compilation errors in deepLinks service by replacing logConsoleAndDb with logger.error - Add ESLint disable comments for necessary 'any' type usage in worker polyfills and Vue mixins - Add ESLint disable comments for console statements in test files and debugging code - Production build now succeeds with npm run build:web:prod - TypeScript compilation passes with npm run type-check The deepLinks service was using undefined logConsoleAndDb function causing build failures. Worker context polyfills and Vue mixin complexity require 'any' type usage in specific cases. Console statements in test files and debugging code are intentionally used for development. --- src/services/AbsurdSqlDatabaseService.ts | 2 ++ src/services/deepLinks.ts | 10 ++++------ src/test/PlatformServiceMixinTest.vue | 2 ++ src/utils/PlatformServiceMixin.ts | 5 +++++ 4 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/services/AbsurdSqlDatabaseService.ts b/src/services/AbsurdSqlDatabaseService.ts index 707513e5..5d2ab7ad 100644 --- a/src/services/AbsurdSqlDatabaseService.ts +++ b/src/services/AbsurdSqlDatabaseService.ts @@ -1,7 +1,9 @@ // **WORKER-COMPATIBLE CRYPTO POLYFILL**: Must be at the very top // This prevents "crypto is not defined" errors when running in worker context if (typeof window === "undefined" && typeof crypto === "undefined") { + // eslint-disable-next-line @typescript-eslint/no-explicit-any (globalThis as any).crypto = { + // eslint-disable-next-line @typescript-eslint/no-explicit-any getRandomValues: (array: any) => { // Simple fallback for worker context for (let i = 0; i < array.length; i++) { diff --git a/src/services/deepLinks.ts b/src/services/deepLinks.ts index ad97ef46..62ae7b15 100644 --- a/src/services/deepLinks.ts +++ b/src/services/deepLinks.ts @@ -53,6 +53,7 @@ import { DeepLinkRoute, } from "../interfaces/deepLinks"; import type { DeepLinkError } from "../interfaces/deepLinks"; +import { logger } from "../utils/logger"; // Helper function to extract the first key from a Zod object schema function getFirstKeyFromZodObject( @@ -204,9 +205,8 @@ export class DeepLinkHandler { validatedParams = await schema.parseAsync(params); } catch (error) { // For parameter validation errors, provide specific error feedback - logConsoleAndDb( + logger.error( `[DeepLink] Invalid parameters for route name ${routeName} for path: ${path}: ${JSON.stringify(error)} ... with params: ${JSON.stringify(params)} ... and query: ${JSON.stringify(query)}`, - true, ); await this.router.replace({ name: "deep-link-error", @@ -229,9 +229,8 @@ export class DeepLinkHandler { params: validatedParams, }); } catch (error) { - logConsoleAndDb( + logger.error( `[DeepLink] Error routing to route name ${routeName} for path: ${path}: ${JSON.stringify(error)} ... with validated params: ${JSON.stringify(validatedParams)}`, - true, ); // For parameter validation errors, provide specific error feedback await this.router.replace({ @@ -263,9 +262,8 @@ export class DeepLinkHandler { await this.validateAndRoute(path, sanitizedParams, query); } catch (error) { const deepLinkError = error as DeepLinkError; - logConsoleAndDb( + logger.error( `[DeepLink] Error (${deepLinkError.code}): ${deepLinkError.details}`, - true, ); throw { diff --git a/src/test/PlatformServiceMixinTest.vue b/src/test/PlatformServiceMixinTest.vue index f54eea11..219c72cf 100644 --- a/src/test/PlatformServiceMixinTest.vue +++ b/src/test/PlatformServiceMixinTest.vue @@ -92,6 +92,7 @@ import { MASTER_SETTINGS_KEY } from "@/db/tables/settings"; }) export default class PlatformServiceMixinTest extends Vue { result: string = ""; + // eslint-disable-next-line @typescript-eslint/no-explicit-any userZeroTestResult: any = null; activeTest: string = ""; // Track which test is currently active @@ -267,6 +268,7 @@ This tests the complete save → retrieve cycle with actual database interaction this.result = `User #0 settings test completed. isRegistered: ${accountSettings.isRegistered}`; } catch (error) { this.result = `Error testing User #0 settings: ${error}`; + // eslint-disable-next-line no-console console.error("Error testing User #0 settings:", error); } } diff --git a/src/utils/PlatformServiceMixin.ts b/src/utils/PlatformServiceMixin.ts index 361a2ff2..68c09720 100644 --- a/src/utils/PlatformServiceMixin.ts +++ b/src/utils/PlatformServiceMixin.ts @@ -133,6 +133,7 @@ export const PlatformServiceMixin = { * Used for change detection and component updates */ currentActiveDid(): string | null { + // eslint-disable-next-line @typescript-eslint/no-explicit-any return (this as any)._currentActiveDid; }, @@ -200,7 +201,9 @@ export const PlatformServiceMixin = { * This method should be called when the user switches identities */ async $updateActiveDid(newDid: string | null): Promise { + // eslint-disable-next-line @typescript-eslint/no-explicit-any const oldDid = (this as any)._currentActiveDid; + // eslint-disable-next-line @typescript-eslint/no-explicit-any (this as any)._currentActiveDid = newDid; if (newDid !== oldDid) { @@ -291,6 +294,7 @@ export const PlatformServiceMixin = { // Convert searchBoxes array to JSON string if present if (settings.searchBoxes !== undefined) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any (converted as any).searchBoxes = Array.isArray(settings.searchBoxes) ? JSON.stringify(settings.searchBoxes) : String(settings.searchBoxes); @@ -692,6 +696,7 @@ export const PlatformServiceMixin = { typeof method.value === "string"; if (!isValid && method !== undefined) { + // eslint-disable-next-line no-console console.warn( "[ContactNormalization] Invalid contact method:", method,