From c80c294d934d6440b803daadfbb1bddac52b830b Mon Sep 17 00:00:00 2001 From: vorotamoroz Date: Mon, 1 Jun 2026 04:20:47 +0100 Subject: [PATCH] satisfies Address following rules - - @typescript-eslint/unbound-method - obsidianmd/prefer-active-doc - obsidianmd/prefer-window-timer Improve typing --- .../HiddenFileSync/CmdHiddenFileSync.ts | 5 +- src/lib | 2 +- .../essentialObsidian/ModuleObsidianEvents.ts | 10 +- src/modules/features/Log/LogPane.svelte | 161 +++++++++--------- .../ObsidianLiveSyncSettingTab.ts | 5 +- .../features/SettingDialogue/PanePatches.ts | 2 +- .../features/SettingDialogue/settingUtils.ts | 2 +- 7 files changed, 97 insertions(+), 90 deletions(-) diff --git a/src/features/HiddenFileSync/CmdHiddenFileSync.ts b/src/features/HiddenFileSync/CmdHiddenFileSync.ts index 6a146dc..ed3aa84 100644 --- a/src/features/HiddenFileSync/CmdHiddenFileSync.ts +++ b/src/features/HiddenFileSync/CmdHiddenFileSync.ts @@ -411,10 +411,7 @@ export class HiddenFileSync extends LiveSyncCommands { } } - async updateLastProcessedAsActualDatabase( - file: FilePath, - doc?: MetaEntry | LoadedEntry | null | false - ) { + async updateLastProcessedAsActualDatabase(file: FilePath, doc?: MetaEntry | LoadedEntry | null | false) { const dbPath = addPrefix(file, ICHeader); if (!doc) doc = await this.localDatabase.getDBEntryMeta(dbPath); if (!doc) return; diff --git a/src/lib b/src/lib index 64d5b17..af21598 160000 --- a/src/lib +++ b/src/lib @@ -1 +1 @@ -Subproject commit 64d5b17925f1c3f91777d45d48d07dad6c5c4ca3 +Subproject commit af21598b785e03f08a01a9bcb317ff686c39c76f diff --git a/src/modules/essentialObsidian/ModuleObsidianEvents.ts b/src/modules/essentialObsidian/ModuleObsidianEvents.ts index 5867116..638b960 100644 --- a/src/modules/essentialObsidian/ModuleObsidianEvents.ts +++ b/src/modules/essentialObsidian/ModuleObsidianEvents.ts @@ -80,11 +80,19 @@ export class ModuleObsidianEvents extends AbstractObsidianModule { this.watchWindowVisibility = this.watchWindowVisibility.bind(this); this.watchWorkspaceOpen = this.watchWorkspaceOpen.bind(this); this.watchOnline = this.watchOnline.bind(this); + // Already bound + // eslint-disable-next-line @typescript-eslint/unbound-method this.plugin.registerEvent(this.app.workspace.on("file-open", this.watchWorkspaceOpen)); - this.plugin.registerDomEvent(document, "visibilitychange", this.watchWindowVisibility); + // Already bound + // eslint-disable-next-line @typescript-eslint/unbound-method + this.plugin.registerDomEvent(activeDocument, "visibilitychange", this.watchWindowVisibility); this.plugin.registerDomEvent(window, "focus", () => this.setHasFocus(true)); this.plugin.registerDomEvent(window, "blur", () => this.setHasFocus(false)); + // Already bound + // eslint-disable-next-line @typescript-eslint/unbound-method this.plugin.registerDomEvent(window, "online", this.watchOnline); + // Already bound + // eslint-disable-next-line @typescript-eslint/unbound-method this.plugin.registerDomEvent(window, "offline", this.watchOnline); } diff --git a/src/modules/features/Log/LogPane.svelte b/src/modules/features/Log/LogPane.svelte index 4fbb7ea..b12669c 100644 --- a/src/modules/features/Log/LogPane.svelte +++ b/src/modules/features/Log/LogPane.svelte @@ -1,11 +1,12 @@
- -
-
- - - + +
+
+ + + -
-
-
- {#each messages as line} -
{line}
- {/each} -
+
+
+
+ {#each messages as line} +
{line}
+ {/each} +
diff --git a/src/modules/features/SettingDialogue/ObsidianLiveSyncSettingTab.ts b/src/modules/features/SettingDialogue/ObsidianLiveSyncSettingTab.ts index 9bdfa56..f6bbd80 100644 --- a/src/modules/features/SettingDialogue/ObsidianLiveSyncSettingTab.ts +++ b/src/modules/features/SettingDialogue/ObsidianLiveSyncSettingTab.ts @@ -62,6 +62,7 @@ import { paneAdvanced } from "./PaneAdvanced.ts"; import { panePowerUsers } from "./PanePowerUsers.ts"; import { panePatches } from "./PanePatches.ts"; import { paneMaintenance } from "./PaneMaintenance.ts"; +import { compatGlobal } from "@lib/common/coreEnvFunctions.ts"; // For creating a document const toc = new Set(); @@ -141,7 +142,7 @@ export class ObsidianLiveSyncSettingTab extends PluginSettingTab { async saveLocalSetting(key: keyof typeof OnDialogSettingsDefault) { if (key == "configPassphrase") { - localStorage.setItem("ls-setting-passphrase", this.editingSettings?.[key] ?? ""); + compatGlobal.localStorage.setItem("ls-setting-passphrase", this.editingSettings?.[key] ?? ""); return await Promise.resolve(); } if (key == "deviceAndVaultName") { @@ -214,7 +215,7 @@ export class ObsidianLiveSyncSettingTab extends PluginSettingTab { reloadAllLocalSettings() { const ret = { ...OnDialogSettingsDefault }; - ret.configPassphrase = localStorage.getItem("ls-setting-passphrase") || ""; + ret.configPassphrase = compatGlobal.localStorage.getItem("ls-setting-passphrase") || ""; ret.preset = ""; ret.deviceAndVaultName = this.services.setting.getDeviceAndVaultName(); return ret; diff --git a/src/modules/features/SettingDialogue/PanePatches.ts b/src/modules/features/SettingDialogue/PanePatches.ts index 13d3bf3..839f7b2 100644 --- a/src/modules/features/SettingDialogue/PanePatches.ts +++ b/src/modules/features/SettingDialogue/PanePatches.ts @@ -188,7 +188,7 @@ export function panePatches(this: ObsidianLiveSyncSettingTab, paneEl: HTMLElemen } this.requestUpdate(); }; - text.inputEl.before((dateEl = document.createElement("span"))); + text.inputEl.before((dateEl = activeDocument.createElement("span"))); text.inputEl.type = "datetime-local"; if (this.editingSettings.maxMTimeForReflectEvents > 0) { const date = new Date(this.editingSettings.maxMTimeForReflectEvents); diff --git a/src/modules/features/SettingDialogue/settingUtils.ts b/src/modules/features/SettingDialogue/settingUtils.ts index b965298..847ebc0 100644 --- a/src/modules/features/SettingDialogue/settingUtils.ts +++ b/src/modules/features/SettingDialogue/settingUtils.ts @@ -75,7 +75,7 @@ export function getSummaryFromPartialSettings(setting: Partial