diff --git a/biome.json b/biome.json index 528024a..691eb06 100644 --- a/biome.json +++ b/biome.json @@ -1,10 +1,16 @@ { - "$schema": "https://biomejs.dev/schemas/2.4.13/schema.json", + "$schema": "https://biomejs.dev/schemas/2.4.15/schema.json", "assist": { "actions": { "source": { "organizeImports": "on" } } }, "linter": { "enabled": true, "rules": { - "recommended": true + "recommended": true, + "suspicious": { + "useAwait": "error" + }, + "nursery": { + "noFloatingPromises": "error" + } } }, "formatter": { diff --git a/src/client.ts b/src/client.ts index f4acd8e..c8568f3 100644 --- a/src/client.ts +++ b/src/client.ts @@ -222,7 +222,7 @@ export class ConfigClient { * * @returns A record mapping field paths to their string values. */ - async getAll( + getAll( tenantId: string, options?: { timeout?: number; signal?: AbortSignal }, ): Promise> { @@ -250,7 +250,7 @@ export class ConfigClient { * coerces it to the schema-defined type. For type-safe writes, prefer * setNumber(), setBool(), setTime(), or setDuration(). */ - async set( + set( tenantId: string, fieldPath: string, value: string, @@ -281,7 +281,7 @@ export class ConfigClient { } /** Set a numeric config value. Sends the native number as a proto numberValue. */ - async setNumber( + setNumber( tenantId: string, fieldPath: string, value: number, @@ -296,7 +296,7 @@ export class ConfigClient { } /** Set a boolean config value. Sends the native boolean as a proto boolValue. */ - async setBool( + setBool( tenantId: string, fieldPath: string, value: boolean, @@ -311,7 +311,7 @@ export class ConfigClient { } /** Set a timestamp config value. Sends the Date as a proto timeValue. */ - async setTime( + setTime( tenantId: string, fieldPath: string, value: Date, @@ -329,7 +329,7 @@ export class ConfigClient { * Set a duration config value. The value must be a duration string * (e.g. "1h30m", "300s") — the server parses and validates the format. */ - async setDuration( + setDuration( tenantId: string, fieldPath: string, value: string, @@ -350,7 +350,7 @@ export class ConfigClient { * @param options - Optional description for the audit log, idempotency key for safe DEADLINE_EXCEEDED retries, * and per-field expected checksums for optimistic concurrency control. */ - async setMany( + setMany( tenantId: string, values: Record, options?: { @@ -383,7 +383,7 @@ export class ConfigClient { /** * Set a config field to null. */ - async setNull( + setNull( tenantId: string, fieldPath: string, options?: { @@ -462,13 +462,14 @@ export class ConfigClient { /** * Async dispose pattern support — use with `await using`. */ - async [Symbol.asyncDispose](): Promise { + [Symbol.asyncDispose](): Promise { this.close(); + return Promise.resolve(); } // --- Private helpers --- - private async setTyped( + private setTyped( tenantId: string, fieldPath: string, value: SetValue, diff --git a/src/watcher.ts b/src/watcher.ts index 1e6afff..c175b9e 100644 --- a/src/watcher.ts +++ b/src/watcher.ts @@ -389,9 +389,9 @@ export class ConfigWatcher extends EventEmitter { * Safe to call multiple times. After stopping, registered WatchedField * async iterators will complete. */ - async stop(): Promise { + stop(): Promise { if (this.stopped) { - return; + return Promise.resolve(); } this.stopped = true; @@ -408,6 +408,7 @@ export class ConfigWatcher extends EventEmitter { for (const field of this.fields.values()) { field._stop(); } + return Promise.resolve(); } /** diff --git a/test/client.test.ts b/test/client.test.ts index 029e177..599f62a 100644 --- a/test/client.test.ts +++ b/test/client.test.ts @@ -645,6 +645,7 @@ describe("ConfigClient", () => { }); it("works with await using", async () => { + // biome-ignore lint/suspicious/useAwait: await using satisfies the await requirement but biome doesn't recognise it yet await (async () => { await using c = client; void c; diff --git a/test/watcher.test.ts b/test/watcher.test.ts index b705862..91ae1df 100644 --- a/test/watcher.test.ts +++ b/test/watcher.test.ts @@ -502,6 +502,7 @@ describe("ConfigWatcher", () => { watcher.field("payments.fee", Number, { default: 0.01 }); await watcher.start(); + // biome-ignore lint/suspicious/useAwait: await using satisfies the await requirement but biome doesn't recognise it yet await (async () => { await using w = watcher; void w;