From fb2d82a06e1cec9041431421e10cf52d942e5a76 Mon Sep 17 00:00:00 2001 From: Andras Schmelczer Date: Sun, 23 Nov 2025 15:13:30 +0000 Subject: [PATCH] Lint --- frontend/obsidian-plugin/src/obsidian-file-system.ts | 5 +++-- frontend/obsidian-plugin/src/vault-link-plugin.ts | 6 +++--- .../src/services/fetch-controller.test.ts | 2 +- .../sync-client/src/services/websocket-manager.ts | 12 ++++++------ frontend/sync-client/src/sync-client.ts | 2 +- frontend/test-client/src/agent/mock-client.ts | 7 ++++--- 6 files changed, 18 insertions(+), 16 deletions(-) diff --git a/frontend/obsidian-plugin/src/obsidian-file-system.ts b/frontend/obsidian-plugin/src/obsidian-file-system.ts index 434d1456..a699433a 100644 --- a/frontend/obsidian-plugin/src/obsidian-file-system.ts +++ b/frontend/obsidian-plugin/src/obsidian-file-system.ts @@ -1,8 +1,9 @@ import type { Stat, Vault, Workspace } from "obsidian"; import { MarkdownView, normalizePath } from "obsidian"; -import { +import type { CursorPosition, - TextWithCursors, + TextWithCursors} from "sync-client"; +import { utils, type FileSystemOperations, type RelativePath diff --git a/frontend/obsidian-plugin/src/vault-link-plugin.ts b/frontend/obsidian-plugin/src/vault-link-plugin.ts index e6373789..47c829bd 100644 --- a/frontend/obsidian-plugin/src/vault-link-plugin.ts +++ b/frontend/obsidian-plugin/src/vault-link-plugin.ts @@ -38,7 +38,7 @@ export default class VaultLinkPlugin extends Plugin { () => Promise >(); - private syncClient: SyncClient | undefined; + private readonly syncClient: SyncClient | undefined; private settingsTab: SyncSettingsTab | undefined; public async onload(): Promise { @@ -152,7 +152,7 @@ export default class VaultLinkPlugin extends Plugin { this.registerView(HistoryView.TYPE, (leaf) => { const view = new HistoryView(client, leaf); - this.register(() => view.onClose()); + this.register(async () => view.onClose()); return view; }); @@ -180,7 +180,7 @@ export default class VaultLinkPlugin extends Plugin { this.app.workspace, client ); - this.register(() => editorStatusDisplayManager.dispose()); + this.register(() => { editorStatusDisplayManager.dispose(); }); } private addRibbonIcons(): void { diff --git a/frontend/sync-client/src/services/fetch-controller.test.ts b/frontend/sync-client/src/services/fetch-controller.test.ts index b349ced2..b4804557 100644 --- a/frontend/sync-client/src/services/fetch-controller.test.ts +++ b/frontend/sync-client/src/services/fetch-controller.test.ts @@ -106,7 +106,7 @@ describe("FetchController", () => { const controller = new FetchController(true, logger); assert.throws( - () => controller.finishReset(), + () => { controller.finishReset(); }, (error: unknown) => error instanceof Error && error.message === "Cannot finish reset when not resetting" diff --git a/frontend/sync-client/src/services/websocket-manager.ts b/frontend/sync-client/src/services/websocket-manager.ts index 06432e89..e399b0be 100644 --- a/frontend/sync-client/src/services/websocket-manager.ts +++ b/frontend/sync-client/src/services/websocket-manager.ts @@ -5,7 +5,7 @@ import type { WebSocketClientMessage } from "./types/WebSocketClientMessage"; import type { CursorPositionFromClient } from "./types/CursorPositionFromClient"; import type { ClientCursors } from "./types/ClientCursors"; import { createPromise } from "../utils/create-promise"; -import { WebSocketVaultUpdate } from "./types/WebSocketVaultUpdate"; +import type { WebSocketVaultUpdate } from "./types/WebSocketVaultUpdate"; export class WebSocketManager { private readonly webSocketStatusChangeListeners: (( @@ -26,7 +26,7 @@ export class WebSocketManager { private resolveDisconnectingPromise: null | (() => unknown) = null; private reconnectTimeoutId: ReturnType | undefined; - private readonly outstandingPromises: Array> = []; + private readonly outstandingPromises: Promise[] = []; private readonly webSocketFactoryImplementation: typeof globalThis.WebSocket; public constructor( @@ -104,7 +104,7 @@ export class WebSocketManager { public sendHandshakeMessage( message: WebSocketClientMessage & { type: "handshake" } ): void { - const webSocket = this.webSocket; + const {webSocket} = this; if (!webSocket) { throw new Error( "WebSocket is not connected, cannot send handshake message" @@ -126,7 +126,7 @@ export class WebSocketManager { type: "cursorPositions", ...cursorPositions }; - const webSocket = this.webSocket; + const {webSocket} = this; if (!webSocket) { this.logger.warn( "WebSocket is not connected, cannot send cursor positions" @@ -194,7 +194,7 @@ export class WebSocketManager { ): Promise { if (message.type === "vaultUpdate") { this.outstandingPromises.push( - ...this.remoteVaultUpdateListeners.map((listener) => + ...this.remoteVaultUpdateListeners.map(async (listener) => listener(message) ) ); @@ -204,7 +204,7 @@ export class WebSocketManager { `Received cursor positions for ${JSON.stringify(message.clients)}` ); this.outstandingPromises.push( - ...this.remoteCursorsUpdateListeners.map((listener) => + ...this.remoteCursorsUpdateListeners.map(async (listener) => listener( message.clients.filter( (client) => client.deviceId !== this.deviceId diff --git a/frontend/sync-client/src/sync-client.ts b/frontend/sync-client/src/sync-client.ts index 26ebe168..4bd27228 100644 --- a/frontend/sync-client/src/sync-client.ts +++ b/frontend/sync-client/src/sync-client.ts @@ -77,7 +77,7 @@ export class SyncClient { // Missing values will be filled in from DEFAULT_SETTINGS rather than // retaining current in-memory settings. public async reloadSettings(): Promise { - let state = (await this.persistence.load()) ?? { + const state = (await this.persistence.load()) ?? { settings: undefined }; diff --git a/frontend/test-client/src/agent/mock-client.ts b/frontend/test-client/src/agent/mock-client.ts index d0b7f451..34186ce7 100644 --- a/frontend/test-client/src/agent/mock-client.ts +++ b/frontend/test-client/src/agent/mock-client.ts @@ -1,11 +1,12 @@ -import type { StoredDatabase } from "sync-client"; +import type { StoredDatabase , + TextWithCursors +} from "sync-client"; import { assert } from "../utils/assert"; import { type RelativePath, type FileSystemOperations, type SyncSettings, - SyncClient, - TextWithCursors + SyncClient } from "sync-client"; export class MockClient implements FileSystemOperations {