From 5efe30d9d650b07240cdfb26feb04d085277d8ea Mon Sep 17 00:00:00 2001 From: Andras Schmelczer Date: Sun, 14 Dec 2025 13:55:23 +0000 Subject: [PATCH] Format & lint --- .github/workflows/e2e.yml | 1 + .../src/services/websocket-manager.ts | 5 +++- frontend/sync-client/src/sync-client.ts | 29 ++++++++++++------- .../sync-client/src/sync-operations/syncer.ts | 2 +- .../src/utils/data-structures/locks.test.ts | 4 +-- .../src/utils/data-structures/locks.ts | 7 +++-- scripts/check.sh | 6 +--- 7 files changed, 32 insertions(+), 22 deletions(-) diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index 19a44428..7d0a2a0f 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -7,6 +7,7 @@ on: branches: ["main"] schedule: - cron: '0 * * * *' + workflow_dispatch: concurrency: group: e2e-tests diff --git a/frontend/sync-client/src/services/websocket-manager.ts b/frontend/sync-client/src/services/websocket-manager.ts index 0cc4d15e..09787bce 100644 --- a/frontend/sync-client/src/services/websocket-manager.ts +++ b/frontend/sync-client/src/services/websocket-manager.ts @@ -190,7 +190,10 @@ export class WebSocketManager { this.webSocket.onopen = (): void => { // Check if we've been stopped while connecting if (this.isStopped) { - this.webSocket?.close(1000, "WebSocketManager was stopped during connection"); + this.webSocket?.close( + 1000, + "WebSocketManager was stopped during connection" + ); return; } this.logger.info("WebSocket connection opened"); diff --git a/frontend/sync-client/src/sync-client.ts b/frontend/sync-client/src/sync-client.ts index 633d20b5..2a272c86 100644 --- a/frontend/sync-client/src/sync-client.ts +++ b/frontend/sync-client/src/sync-client.ts @@ -55,9 +55,8 @@ export class SyncClient { settings: Partial; database: Partial; }> - >, - ) { - } + > + ) {} public get documentCount(): number { return this.database.length; @@ -256,11 +255,13 @@ export class SyncClient { this.unloadTelemetry = setUpTelemetry(); } - this.eventUnsubscribers.push(this.settings.onSettingsChanged.add((newSettings, oldSettings) => { - if (oldSettings.isSyncEnabled != newSettings.isSyncEnabled) { - this.fetchController.canFetch = newSettings.isSyncEnabled; - } - })); + this.eventUnsubscribers.push( + this.settings.onSettingsChanged.add((newSettings, oldSettings) => { + if (oldSettings.isSyncEnabled != newSettings.isSyncEnabled) { + this.fetchController.canFetch = newSettings.isSyncEnabled; + } + }) + ); this.eventUnsubscribers.push( this.logger.onLogEmitted.add((log): void => { @@ -271,7 +272,9 @@ export class SyncClient { ); this.eventUnsubscribers.push( - this.settings.onSettingsChanged.add(this.onSettingsChange.bind(this)) + this.settings.onSettingsChanged.add( + this.onSettingsChange.bind(this) + ) ); if (this.settings.getSettings().isSyncEnabled) { @@ -441,7 +444,9 @@ export class SyncClient { // Prevent concurrent destroy calls if (this.isDestroying) { - this.logger.warn("destroy() called while already destroying, ignoring"); + this.logger.warn( + "destroy() called while already destroying, ignoring" + ); return; } this.isDestroying = true; @@ -454,7 +459,9 @@ export class SyncClient { this.resetInMemoryState(); // Clean up event listeners to prevent memory leaks - this.eventUnsubscribers.forEach((unsubscribe) => unsubscribe()); + this.eventUnsubscribers.forEach((unsubscribe) => { + unsubscribe(); + }); this.eventUnsubscribers.length = 0; this.logger.info("SyncClient has been successfully disposed"); diff --git a/frontend/sync-client/src/sync-operations/syncer.ts b/frontend/sync-client/src/sync-operations/syncer.ts index 709b9f62..71dedd85 100644 --- a/frontend/sync-client/src/sync-operations/syncer.ts +++ b/frontend/sync-client/src/sync-operations/syncer.ts @@ -171,7 +171,7 @@ export class Syncer { // in that case, we mustn't move it again. if ( this.database.getLatestDocumentByRelativePath(relativePath) === - undefined || + undefined || this.database.getLatestDocumentByRelativePath(relativePath) ?.isDeleted === true ) { diff --git a/frontend/sync-client/src/utils/data-structures/locks.test.ts b/frontend/sync-client/src/utils/data-structures/locks.test.ts index c1a4fb4b..9beb867a 100644 --- a/frontend/sync-client/src/utils/data-structures/locks.test.ts +++ b/frontend/sync-client/src/utils/data-structures/locks.test.ts @@ -252,7 +252,7 @@ describe("reset", () => { await sleep(1); const secondPromise = locks.withLock(testPath, async () => "second"); - void secondPromise.catch(() => { }); + void secondPromise.catch(() => {}); // eslint-disable-line @typescript-eslint/no-empty-function locks.reset(); @@ -273,7 +273,7 @@ describe("reset", () => { await sleep(1); const secondPromise = locks.withLock(testPath, async () => "second"); - void secondPromise.catch(() => { }); + void secondPromise.catch(() => {}); // eslint-disable-line @typescript-eslint/no-empty-function locks.reset(); diff --git a/frontend/sync-client/src/utils/data-structures/locks.ts b/frontend/sync-client/src/utils/data-structures/locks.ts index 3f676667..e55c76b0 100644 --- a/frontend/sync-client/src/utils/data-structures/locks.ts +++ b/frontend/sync-client/src/utils/data-structures/locks.ts @@ -13,9 +13,12 @@ export class Locks { private readonly locked = new Set(); /** Queue of resolve functions waiting for each key */ - private readonly waiters = new Map unknown, (err: unknown) => unknown])[]>(); + private readonly waiters = new Map< + T, + [() => unknown, (err: unknown) => unknown][] + >(); - public constructor(private readonly logger?: Logger) { } + public constructor(private readonly logger?: Logger) {} /** * Executes a function while holding exclusive locks on one or more keys. diff --git a/scripts/check.sh b/scripts/check.sh index bac8f3c3..7c3c87e5 100755 --- a/scripts/check.sh +++ b/scripts/check.sh @@ -58,8 +58,4 @@ fi cd .. -if [[ "$FIX_MODE" == true ]]; then - $0 -else - echo "Success" -fi +echo "Success"