Browse Source

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.
pull/166/head
Matthew Raymer 2 days ago
parent
commit
8c0b547855
  1. 2
      src/services/AbsurdSqlDatabaseService.ts
  2. 10
      src/services/deepLinks.ts
  3. 2
      src/test/PlatformServiceMixinTest.vue
  4. 5
      src/utils/PlatformServiceMixin.ts

2
src/services/AbsurdSqlDatabaseService.ts

@ -1,7 +1,9 @@
// **WORKER-COMPATIBLE CRYPTO POLYFILL**: Must be at the very top // **WORKER-COMPATIBLE CRYPTO POLYFILL**: Must be at the very top
// This prevents "crypto is not defined" errors when running in worker context // This prevents "crypto is not defined" errors when running in worker context
if (typeof window === "undefined" && typeof crypto === "undefined") { if (typeof window === "undefined" && typeof crypto === "undefined") {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
(globalThis as any).crypto = { (globalThis as any).crypto = {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
getRandomValues: (array: any) => { getRandomValues: (array: any) => {
// Simple fallback for worker context // Simple fallback for worker context
for (let i = 0; i < array.length; i++) { for (let i = 0; i < array.length; i++) {

10
src/services/deepLinks.ts

@ -53,6 +53,7 @@ import {
DeepLinkRoute, DeepLinkRoute,
} from "../interfaces/deepLinks"; } from "../interfaces/deepLinks";
import type { DeepLinkError } 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 // Helper function to extract the first key from a Zod object schema
function getFirstKeyFromZodObject( function getFirstKeyFromZodObject(
@ -204,9 +205,8 @@ export class DeepLinkHandler {
validatedParams = await schema.parseAsync(params); validatedParams = await schema.parseAsync(params);
} catch (error) { } catch (error) {
// For parameter validation errors, provide specific error feedback // 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)}`, `[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({ await this.router.replace({
name: "deep-link-error", name: "deep-link-error",
@ -229,9 +229,8 @@ export class DeepLinkHandler {
params: validatedParams, params: validatedParams,
}); });
} catch (error) { } catch (error) {
logConsoleAndDb( logger.error(
`[DeepLink] Error routing to route name ${routeName} for path: ${path}: ${JSON.stringify(error)} ... with validated params: ${JSON.stringify(validatedParams)}`, `[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 // For parameter validation errors, provide specific error feedback
await this.router.replace({ await this.router.replace({
@ -263,9 +262,8 @@ export class DeepLinkHandler {
await this.validateAndRoute(path, sanitizedParams, query); await this.validateAndRoute(path, sanitizedParams, query);
} catch (error) { } catch (error) {
const deepLinkError = error as DeepLinkError; const deepLinkError = error as DeepLinkError;
logConsoleAndDb( logger.error(
`[DeepLink] Error (${deepLinkError.code}): ${deepLinkError.details}`, `[DeepLink] Error (${deepLinkError.code}): ${deepLinkError.details}`,
true,
); );
throw { throw {

2
src/test/PlatformServiceMixinTest.vue

@ -92,6 +92,7 @@ import { MASTER_SETTINGS_KEY } from "@/db/tables/settings";
}) })
export default class PlatformServiceMixinTest extends Vue { export default class PlatformServiceMixinTest extends Vue {
result: string = ""; result: string = "";
// eslint-disable-next-line @typescript-eslint/no-explicit-any
userZeroTestResult: any = null; userZeroTestResult: any = null;
activeTest: string = ""; // Track which test is currently active 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}`; this.result = `User #0 settings test completed. isRegistered: ${accountSettings.isRegistered}`;
} catch (error) { } catch (error) {
this.result = `Error testing User #0 settings: ${error}`; this.result = `Error testing User #0 settings: ${error}`;
// eslint-disable-next-line no-console
console.error("Error testing User #0 settings:", error); console.error("Error testing User #0 settings:", error);
} }
} }

5
src/utils/PlatformServiceMixin.ts

@ -133,6 +133,7 @@ export const PlatformServiceMixin = {
* Used for change detection and component updates * Used for change detection and component updates
*/ */
currentActiveDid(): string | null { currentActiveDid(): string | null {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
return (this as any)._currentActiveDid; return (this as any)._currentActiveDid;
}, },
@ -200,7 +201,9 @@ export const PlatformServiceMixin = {
* This method should be called when the user switches identities * This method should be called when the user switches identities
*/ */
async $updateActiveDid(newDid: string | null): Promise<void> { async $updateActiveDid(newDid: string | null): Promise<void> {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const oldDid = (this as any)._currentActiveDid; const oldDid = (this as any)._currentActiveDid;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
(this as any)._currentActiveDid = newDid; (this as any)._currentActiveDid = newDid;
if (newDid !== oldDid) { if (newDid !== oldDid) {
@ -291,6 +294,7 @@ export const PlatformServiceMixin = {
// Convert searchBoxes array to JSON string if present // Convert searchBoxes array to JSON string if present
if (settings.searchBoxes !== undefined) { if (settings.searchBoxes !== undefined) {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
(converted as any).searchBoxes = Array.isArray(settings.searchBoxes) (converted as any).searchBoxes = Array.isArray(settings.searchBoxes)
? JSON.stringify(settings.searchBoxes) ? JSON.stringify(settings.searchBoxes)
: String(settings.searchBoxes); : String(settings.searchBoxes);
@ -692,6 +696,7 @@ export const PlatformServiceMixin = {
typeof method.value === "string"; typeof method.value === "string";
if (!isValid && method !== undefined) { if (!isValid && method !== undefined) {
// eslint-disable-next-line no-console
console.warn( console.warn(
"[ContactNormalization] Invalid contact method:", "[ContactNormalization] Invalid contact method:",
method, method,

Loading…
Cancel
Save