From 770d4af4a099c95a1230c9aa29d5e3cebbe699c7 Mon Sep 17 00:00:00 2001 From: vorotamoroz Date: Wed, 13 May 2026 10:15:45 +0100 Subject: [PATCH] Update eslint config to ignore file, fix some type error on LiveSyncBaseCore --- eslint.config.mjs | 4 ++++ src/LiveSyncBaseCore.ts | 18 ++++++++++-------- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/eslint.config.mjs b/eslint.config.mjs index 0efa595..35b0d25 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -33,6 +33,10 @@ export default defineConfig([ ".prettierrc.*.mjs", ".prettierrc.mjs", "*.config.mjs", + "src/apps/**/*", + "src/lib/src/services/implements/browser/**", + "src/lib/src/services/implements/headless/**", + "src/lib/src/API", ]), ...sveltePlugin.configs["flat/base"], ...obsidianmd.configs.recommended, diff --git a/src/LiveSyncBaseCore.ts b/src/LiveSyncBaseCore.ts index f9f0427..a3945fd 100644 --- a/src/LiveSyncBaseCore.ts +++ b/src/LiveSyncBaseCore.ts @@ -1,4 +1,5 @@ import { LOG_LEVEL_INFO } from "octagonal-wheels/common/logger"; +import type PouchDB from "pouchdb-core"; import type { SimpleStore } from "octagonal-wheels/databases/SimpleStoreBase"; import type { HasSettings, ObsidianLiveSyncSettings, EntryDoc } from "./lib/src/common/types"; import { __$checkInstanceBinding } from "./lib/src/dev/checks"; @@ -34,12 +35,11 @@ export class LiveSyncBaseCore< TCommands extends IMinimumLiveSyncCommands = IMinimumLiveSyncCommands, > implements - LiveSyncLocalDBEnv, - LiveSyncReplicatorEnv, - LiveSyncJournalReplicatorEnv, - LiveSyncCouchDBReplicatorEnv, - HasSettings -{ + LiveSyncLocalDBEnv, + LiveSyncReplicatorEnv, + LiveSyncJournalReplicatorEnv, + LiveSyncCouchDBReplicatorEnv, + HasSettings { addOns = [] as TCommands[]; /** @@ -123,7 +123,7 @@ export class LiveSyncBaseCore< for (const module of this.modules) { if (module.constructor === constructor) return module as T; } - throw new Error(`Module ${constructor} not found or not loaded.`); + throw new Error(`Module ${constructor.name} not found or not loaded.`); } /** @@ -160,8 +160,10 @@ export class LiveSyncBaseCore< module.onBindFunction(this, this.services); __$checkInstanceBinding(module); // Check if all functions are properly bound, and log warnings if not. } else { + // module should not be never. + const moduleName = (module as unknown)?.constructor?.name ?? "unknown"; this.services.API.addLog( - `Module ${(module as any)?.constructor?.name ?? "unknown"} does not have onBindFunction, skipping binding.`, + `Module ${moduleName} does not have onBindFunction, skipping binding.`, LOG_LEVEL_INFO ); }