From c63799999a16c22a02e845875d8800417a2ab53d Mon Sep 17 00:00:00 2001 From: Matthew Raymer Date: Thu, 3 Jul 2025 11:00:27 +0000 Subject: [PATCH] chore: resolve all TypeScript lint warnings in PlatformServiceMixin - Fix remaining type warnings by specifying Settings for cache and using this._setCached directly - Add eslint-disable-next-line comments for unavoidable (this as any) usages required for Vue context access - All @typescript-eslint/no-explicit-any warnings are now suppressed or resolved - Lint passes with zero warnings or errors - No functional changes; improves code clarity and developer experience --- src/utils/PlatformServiceMixin.ts | 34 +++++++++++++++++++++---------- 1 file changed, 23 insertions(+), 11 deletions(-) diff --git a/src/utils/PlatformServiceMixin.ts b/src/utils/PlatformServiceMixin.ts index ace6cc2e..8d7ff404 100644 --- a/src/utils/PlatformServiceMixin.ts +++ b/src/utils/PlatformServiceMixin.ts @@ -221,9 +221,11 @@ export const PlatformServiceMixin = { */ async $dbQuery(sql: string, params?: unknown[]) { try { + // eslint-disable-next-line @typescript-eslint/no-explicit-any return await (this as any).platformService.dbQuery(sql, params); } catch (error) { logger.error( + // eslint-disable-next-line @typescript-eslint/no-explicit-any `[${(this as any).$options.name}] Database query failed:`, { sql, @@ -240,13 +242,18 @@ export const PlatformServiceMixin = { */ async $dbExec(sql: string, params?: unknown[]) { try { + // eslint-disable-next-line @typescript-eslint/no-explicit-any return await (this as any).platformService.dbExec(sql, params); } catch (error) { - logger.error(`[${(this as any).$options.name}] Database exec failed:`, { - sql, - params, - error, - }); + logger.error( + // eslint-disable-next-line @typescript-eslint/no-explicit-any + `[${(this as any).$options.name}] Database exec failed:`, + { + sql, + params, + error, + }, + ); throw error; } }, @@ -256,9 +263,11 @@ export const PlatformServiceMixin = { */ async $dbGetOneRow(sql: string, params?: unknown[]) { try { + // eslint-disable-next-line @typescript-eslint/no-explicit-any return await (this as any).platformService.dbGetOneRow(sql, params); } catch (error) { logger.error( + // eslint-disable-next-line @typescript-eslint/no-explicit-any `[${(this as any).$options.name}] Database single row query failed:`, { sql, @@ -417,6 +426,7 @@ export const PlatformServiceMixin = { sql: string, params: unknown[] = [], ): Promise { + // eslint-disable-next-line @typescript-eslint/no-explicit-any return await (this as any).platformService.dbQuery(sql, params); }, @@ -429,6 +439,7 @@ export const PlatformServiceMixin = { sql: string, params: unknown[] = [], ): Promise { + // eslint-disable-next-line @typescript-eslint/no-explicit-any return await (this as any).platformService.dbExec(sql, params); }, @@ -441,6 +452,7 @@ export const PlatformServiceMixin = { sql: string, params: unknown[] = [], ): Promise { + // eslint-disable-next-line @typescript-eslint/no-explicit-any return await (this as any).platformService.dbGetOneRow(sql, params); }, @@ -459,6 +471,7 @@ export const PlatformServiceMixin = { sql: string, params: unknown[] = [], ): Promise { + // eslint-disable-next-line @typescript-eslint/no-explicit-any const result = await (this as any).platformService.dbQuery(sql, params); if (!result?.columns || !result?.values) { return []; @@ -515,7 +528,7 @@ export const PlatformServiceMixin = { */ async $settings(defaults: Settings = {}): Promise { const cacheKey = `settings_${String(MASTER_SETTINGS_KEY)}`; - const cached = this._getCached(cacheKey); + const cached = this._getCached(cacheKey); if (cached) { return { ...cached, ...defaults }; // Merge with any new defaults } @@ -536,11 +549,7 @@ export const PlatformServiceMixin = { settings.apiServer = DEFAULT_ENDORSER_API_SERVER; } - return (this as any)._setCached( - cacheKey, - settings, - CACHE_DEFAULTS.settings, - ); + return this._setCached(cacheKey, settings, CACHE_DEFAULTS.settings); }, /** @@ -553,6 +562,7 @@ export const PlatformServiceMixin = { did?: string, defaults: Settings = {}, ): Promise { + // eslint-disable-next-line @typescript-eslint/no-explicit-any const currentDid = did || (this as any).activeDid; const cacheKey = `account_settings_${currentDid || "default"}`; @@ -622,6 +632,7 @@ export const PlatformServiceMixin = { * @returns Promise Success status */ async $saveMySettings(changes: Partial): Promise { + // eslint-disable-next-line @typescript-eslint/no-explicit-any const currentDid = (this as any).activeDid; if (!currentDid) { return await this.$saveSettings(changes); @@ -639,6 +650,7 @@ export const PlatformServiceMixin = { */ async $refreshSettings(): Promise { this._invalidateCache(`settings_${MASTER_SETTINGS_KEY}`); + // eslint-disable-next-line @typescript-eslint/no-explicit-any const currentDid = (this as any).activeDid; if (currentDid) { this._invalidateCache(`account_settings_${currentDid}`);