satisfies

Address following rules
-
- @typescript-eslint/unbound-method
- obsidianmd/prefer-active-doc
- obsidianmd/prefer-window-timer

Improve typing
This commit is contained in:
vorotamoroz
2026-06-01 04:20:47 +01:00
parent 3e65ae932d
commit c80c294d93
7 changed files with 97 additions and 90 deletions
@@ -411,10 +411,7 @@ export class HiddenFileSync extends LiveSyncCommands {
} }
} }
async updateLastProcessedAsActualDatabase( async updateLastProcessedAsActualDatabase(file: FilePath, doc?: MetaEntry | LoadedEntry | null | false) {
file: FilePath,
doc?: MetaEntry | LoadedEntry | null | false
) {
const dbPath = addPrefix(file, ICHeader); const dbPath = addPrefix(file, ICHeader);
if (!doc) doc = await this.localDatabase.getDBEntryMeta(dbPath); if (!doc) doc = await this.localDatabase.getDBEntryMeta(dbPath);
if (!doc) return; if (!doc) return;
+1 -1
Submodule src/lib updated: 64d5b17925...af21598b78
@@ -80,11 +80,19 @@ export class ModuleObsidianEvents extends AbstractObsidianModule {
this.watchWindowVisibility = this.watchWindowVisibility.bind(this); this.watchWindowVisibility = this.watchWindowVisibility.bind(this);
this.watchWorkspaceOpen = this.watchWorkspaceOpen.bind(this); this.watchWorkspaceOpen = this.watchWorkspaceOpen.bind(this);
this.watchOnline = this.watchOnline.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.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, "focus", () => this.setHasFocus(true));
this.plugin.registerDomEvent(window, "blur", () => this.setHasFocus(false)); 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); this.plugin.registerDomEvent(window, "online", this.watchOnline);
// Already bound
// eslint-disable-next-line @typescript-eslint/unbound-method
this.plugin.registerDomEvent(window, "offline", this.watchOnline); this.plugin.registerDomEvent(window, "offline", this.watchOnline);
} }
+2 -1
View File
@@ -4,6 +4,7 @@
import { reactive, type ReactiveInstance } from "octagonal-wheels/dataobject/reactive"; import { reactive, type ReactiveInstance } from "octagonal-wheels/dataobject/reactive";
import { Logger } from "../../../lib/src/common/logger"; import { Logger } from "../../../lib/src/common/logger";
import { $msg as msg, currentLang as lang } from "../../../lib/src/common/i18n.ts"; import { $msg as msg, currentLang as lang } from "../../../lib/src/common/i18n.ts";
import { compatGlobal } from "@lib/common/coreEnvFunctions.ts";
let unsubscribe: () => void; let unsubscribe: () => void;
let messages = $state([] as string[]); let messages = $state([] as string[]);
@@ -20,7 +21,7 @@
const e = logs.value; const e = logs.value;
if (!suspended) { if (!suspended) {
messages = [...e]; messages = [...e];
setTimeout(() => { compatGlobal.setTimeout(() => {
if (scroll) scroll.scrollTop = scroll.scrollHeight; if (scroll) scroll.scrollTop = scroll.scrollHeight;
}, 10); }, 10);
} }
@@ -62,6 +62,7 @@ import { paneAdvanced } from "./PaneAdvanced.ts";
import { panePowerUsers } from "./PanePowerUsers.ts"; import { panePowerUsers } from "./PanePowerUsers.ts";
import { panePatches } from "./PanePatches.ts"; import { panePatches } from "./PanePatches.ts";
import { paneMaintenance } from "./PaneMaintenance.ts"; import { paneMaintenance } from "./PaneMaintenance.ts";
import { compatGlobal } from "@lib/common/coreEnvFunctions.ts";
// For creating a document // For creating a document
const toc = new Set<string>(); const toc = new Set<string>();
@@ -141,7 +142,7 @@ export class ObsidianLiveSyncSettingTab extends PluginSettingTab {
async saveLocalSetting(key: keyof typeof OnDialogSettingsDefault) { async saveLocalSetting(key: keyof typeof OnDialogSettingsDefault) {
if (key == "configPassphrase") { if (key == "configPassphrase") {
localStorage.setItem("ls-setting-passphrase", this.editingSettings?.[key] ?? ""); compatGlobal.localStorage.setItem("ls-setting-passphrase", this.editingSettings?.[key] ?? "");
return await Promise.resolve(); return await Promise.resolve();
} }
if (key == "deviceAndVaultName") { if (key == "deviceAndVaultName") {
@@ -214,7 +215,7 @@ export class ObsidianLiveSyncSettingTab extends PluginSettingTab {
reloadAllLocalSettings() { reloadAllLocalSettings() {
const ret = { ...OnDialogSettingsDefault }; const ret = { ...OnDialogSettingsDefault };
ret.configPassphrase = localStorage.getItem("ls-setting-passphrase") || ""; ret.configPassphrase = compatGlobal.localStorage.getItem("ls-setting-passphrase") || "";
ret.preset = ""; ret.preset = "";
ret.deviceAndVaultName = this.services.setting.getDeviceAndVaultName(); ret.deviceAndVaultName = this.services.setting.getDeviceAndVaultName();
return ret; return ret;
@@ -188,7 +188,7 @@ export function panePatches(this: ObsidianLiveSyncSettingTab, paneEl: HTMLElemen
} }
this.requestUpdate(); this.requestUpdate();
}; };
text.inputEl.before((dateEl = document.createElement("span"))); text.inputEl.before((dateEl = activeDocument.createElement("span")));
text.inputEl.type = "datetime-local"; text.inputEl.type = "datetime-local";
if (this.editingSettings.maxMTimeForReflectEvents > 0) { if (this.editingSettings.maxMTimeForReflectEvents > 0) {
const date = new Date(this.editingSettings.maxMTimeForReflectEvents); const date = new Date(this.editingSettings.maxMTimeForReflectEvents);
@@ -75,7 +75,7 @@ export function getSummaryFromPartialSettings(setting: Partial<ObsidianLiveSyncS
if (config.isAdvanced && !showAdvanced) continue; if (config.isAdvanced && !showAdvanced) continue;
const value = const value =
key != "E2EEAlgorithm" key != "E2EEAlgorithm"
? `${setting[key]}` ? `${setting[key] as string}`
: E2EEAlgorithmNames[`${setting[key]}` as keyof typeof E2EEAlgorithmNames]; : E2EEAlgorithmNames[`${setting[key]}` as keyof typeof E2EEAlgorithmNames];
const displayValue = config.isHidden ? "•".repeat(value.length) : escapeStringToHTML(value); const displayValue = config.isHidden ? "•".repeat(value.length) : escapeStringToHTML(value);
outputSummary[config.name] = displayValue; outputSummary[config.name] = displayValue;