style(storage,workspace): satisfy the repository lint gate

eslint --fix formatting sweep plus the manual residue: sync method
bodies drop async behind Promise-returning signatures (the sqlite unit
routes primitives through a settle() guard preserving the never-throws-
synchronously contract), catch callbacks type their reason as unknown,
loadAll's global slot is plain unknown (null semantics stay in JSDoc),
a non-null assertion becomes a narrowing, and unsafe any assignments in
tests gain explicit types. One justified eslint-disable for
prefer-promise-reject-errors follows the core/session precedent —
wrapping would discard the original StorageError code.
This commit is contained in:
imccyu
2026-07-24 23:41:39 +08:00
parent 25a4a2063b
commit 2e986ee1e3
14 changed files with 113 additions and 78 deletions

View File

@@ -69,7 +69,7 @@ export interface KvUnit {
* @returns every table's records keyed by table name, plus the global
* singleton (`null` when never written or not declared).
*/
loadAll(): Promise<{ tables: Record<string, Record<string, unknown>>; global: unknown | null }>
loadAll(): Promise<{ tables: Record<string, Record<string, unknown>>; global: unknown }>
/**
* Upsert one record durably. Overwrite semantics: an existing key is replaced.

View File

@@ -76,7 +76,7 @@ export class Storage extends Service {
/** Domain data form; present once the domain layer plugin is loaded. */
get domain(): StorageForms extends { domain: infer D } ? D : never {
return this.form('domain' as keyof StorageForms) as StorageForms extends { domain: infer D } ? D : never
return this.form('domain' as keyof StorageForms)
}
}

View File

@@ -69,7 +69,7 @@ expect.extend({
received()
} catch (error) {
const pass = Object.entries(expected).every(
(entry) => (error as Record<string, unknown>)[entry[0]] === entry[1],
entry => (error as Record<string, unknown>)[entry[0]] === entry[1],
)
return { pass, message: () => `expected thrown error to match ${JSON.stringify(expected)}, got ${String(error)}` }
}