Format & lint

This commit is contained in:
Andras Schmelczer 2025-12-14 13:55:23 +00:00
parent 0e0a85df82
commit 5efe30d9d6
7 changed files with 32 additions and 22 deletions

View file

@ -7,6 +7,7 @@ on:
branches: ["main"]
schedule:
- cron: '0 * * * *'
workflow_dispatch:
concurrency:
group: e2e-tests

View file

@ -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");

View file

@ -55,9 +55,8 @@ export class SyncClient {
settings: Partial<SyncSettings>;
database: Partial<StoredDatabase>;
}>
>,
) {
}
>
) {}
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");

View file

@ -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
) {

View file

@ -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();

View file

@ -13,9 +13,12 @@ export class Locks<T> {
private readonly locked = new Set<T>();
/** Queue of resolve functions waiting for each key */
private readonly waiters = new Map<T, ([() => 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.

View file

@ -58,8 +58,4 @@ fi
cd ..
if [[ "$FIX_MODE" == true ]]; then
$0
else
echo "Success"
fi
echo "Success"