diff --git a/STYLE.md b/STYLE.md index 75b04298..a8ea0d78 100644 --- a/STYLE.md +++ b/STYLE.md @@ -106,6 +106,10 @@ this.eventHook.dispatchEvent(...); export class Client { ``` +### Promise Handling + +Use `void` to mark intentionally fire-and-forget promises. This satisfies the `noFloatingPromises` lint rule and signals that the unawaited call is deliberate. + ### Code Patterns **Definite assignment for late initialization:** @@ -126,4 +130,4 @@ const { text, meta } = await this.space.readPage(name); Follow common Go conventions. `make fmt` also reformats Go code. ## Lua (libraries) -See `website/Space Lua/Conventions` \ No newline at end of file +See `website/Space Lua/Conventions` diff --git a/biome.json b/biome.json index caf4c0b1..eb97ca96 100644 --- a/biome.json +++ b/biome.json @@ -28,6 +28,9 @@ }, "correctness": { "noInnerDeclarations": "off" + }, + "nursery": { + "noFloatingPromises": "error" } } }, diff --git a/build_client.ts b/build_client.ts index a08bd714..878ea033 100644 --- a/build_client.ts +++ b/build_client.ts @@ -89,5 +89,5 @@ async function buildCopyBundleAssets() { const isMain = process.argv[1] === fileURLToPath(import.meta.url); if (isMain) { await bundleAll(); - esbuild.stop(); + await esbuild.stop(); } diff --git a/build_plug_compile.ts b/build_plug_compile.ts index a7cf1c9a..135485b8 100644 --- a/build_plug_compile.ts +++ b/build_plug_compile.ts @@ -38,4 +38,4 @@ if (result.metafile) { // "utf-8", // ); console.log("Output in dist"); -esbuild.stop(); +await esbuild.stop(); diff --git a/build_plugs_libraries.ts b/build_plugs_libraries.ts index f41f7354..467746b6 100644 --- a/build_plugs_libraries.ts +++ b/build_plugs_libraries.ts @@ -48,7 +48,7 @@ if (isMain) { debug: args.debug as boolean | undefined, info: args.info as boolean | undefined, }); - esbuild.stop(); + await esbuild.stop(); } export async function updateVersionFile() { diff --git a/client/boot.ts b/client/boot.ts index 29082fc1..699057b3 100644 --- a/client/boot.ts +++ b/client/boot.ts @@ -112,7 +112,7 @@ safeRun(async () => { "message", keyListener, ); - importKey(e.data.key).then((key) => { + void importKey(e.data.key).then((key) => { encryptionKey = key; resolve(); }); @@ -232,7 +232,7 @@ safeRun(async () => { ); if (bootConfig!.logPush) { setInterval(() => { - logger.postToServer(".logs", "client"); + void logger.postToServer(".logs", "client"); }, 1000); } globalThis.client = client; @@ -240,7 +240,7 @@ safeRun(async () => { await client.init(encryptionKey); if (navigator.serviceWorker) { navigator.serviceWorker.addEventListener("message", (event) => { - client.handleServiceWorkerMessage(event.data); + void client.handleServiceWorkerMessage(event.data); }); } }); diff --git a/client/client.ts b/client/client.ts index 5f1ede48..dd209690 100644 --- a/client/client.ts +++ b/client/client.ts @@ -289,7 +289,7 @@ export class Client { // Kick off a cron event interval setInterval(() => { - this.dispatchAppEvent("cron:secondPassed"); + void this.dispatchAppEvent("cron:secondPassed"); }, 1000); // We can load custom styles async @@ -335,7 +335,7 @@ export class Client { // Kick off a regular file listing request to trigger events setInterval(() => { - this.eventedSpacePrimitives.fetchFileList(); + void this.eventedSpacePrimitives.fetchFileList(); }, fetchFileListInterval + jitter()); this.eventHook.addLocalListener( @@ -396,7 +396,7 @@ export class Client { this.flashNotification( "Page or document changed elsewhere, reloading", ); - this.reloadEditor(); + void this.reloadEditor(); } }, ); @@ -477,7 +477,7 @@ export class Client { if (this.isDocumentEditor()) { console.log("Requesting save for document", this.currentPath()); - this.dispatchAppEvent( + void this.dispatchAppEvent( "editor:documentSaving", this.currentPath(), ); @@ -488,7 +488,7 @@ export class Client { return resolve(); } else { console.log("Saving page", this.currentPath()); - this.dispatchAppEvent( + void this.dispatchAppEvent( "editor:pageSaving", this.currentName(), ); @@ -568,7 +568,7 @@ export class Client { this.flashNotification(`Lua error: ${e.message}`, "error"); const origin = resolveASTReference(e.sf.astCtx!); if (origin) { - client.navigate(origin); + void client.navigate(origin); } } else { this.flashNotification(`Error: ${e.message}`, "error"); @@ -662,7 +662,7 @@ export class Client { }); // Async kick-off file listing to bring listing up to date - this.space.spacePrimitives.fetchFileList(); + void this.space.spacePrimitives.fetchFileList(); } async updateDocumentListCache() { diff --git a/client/codemirror/clean.ts b/client/codemirror/clean.ts index b58bc0ed..09710954 100644 --- a/client/codemirror/clean.ts +++ b/client/codemirror/clean.ts @@ -50,7 +50,7 @@ export function cleanModePlugins(client: Client) { pos: pos, }; // Propagate click event from checkbox - client.dispatchClickEvent(clickEvent); + void client.dispatchClickEvent(clickEvent); }, }), listBulletPlugin(), diff --git a/client/codemirror/editor_state.ts b/client/codemirror/editor_state.ts index 75ce5f32..935722b6 100644 --- a/client/codemirror/editor_state.ts +++ b/client/codemirror/editor_state.ts @@ -290,10 +290,10 @@ export function createEditorState( for (const tr of update.transactions) { for (const e of tr.effects) { if (e.is(foldEffect)) { - client.dispatchAppEvent("editor:fold", e.value); + void client.dispatchAppEvent("editor:fold", e.value); } if (e.is(unfoldEffect)) { - client.dispatchAppEvent("editor:unfold", e.value); + void client.dispatchAppEvent("editor:unfold", e.value); } } } @@ -313,7 +313,7 @@ export function createEditorState( newRange: { from: fromB, to: toB }, }) ); - client.dispatchAppEvent("editor:pageModified", { changes }); + void client.dispatchAppEvent("editor:pageModified", { changes }); client.ui.viewDispatch({ type: "page-changed" }); client.debouncedUpdateEvent(); client.save().catch((e) => console.error("Error saving", e)); @@ -359,7 +359,7 @@ export function createCommandKeyBindings(client: Client): Extension { return false; } } - Promise.resolve([]) + void Promise.resolve([]) .then(def.run) .catch((e: any) => { client.reportError(e, "key"); diff --git a/client/codemirror/frontmatter.ts b/client/codemirror/frontmatter.ts index b35b1db0..fb098184 100644 --- a/client/codemirror/frontmatter.ts +++ b/client/codemirror/frontmatter.ts @@ -158,7 +158,7 @@ export function frontmatterPlugin(client: Client) { client.focus(); return; } - client.navigate( + void client.navigate( ref, false, e.ctrlKey || e.metaKey, diff --git a/client/codemirror/iframe_widget.ts b/client/codemirror/iframe_widget.ts index ad4ffb28..daa3b5da 100644 --- a/client/codemirror/iframe_widget.ts +++ b/client/codemirror/iframe_widget.ts @@ -44,7 +44,7 @@ export class IFrameWidget extends WidgetType { break; case "reload": - this.codeWidgetCallback( + void this.codeWidgetCallback( this.bodyText, this.client.currentName(), ) diff --git a/client/codemirror/lua_widget.ts b/client/codemirror/lua_widget.ts index 9e97ceb2..c92d3758 100644 --- a/client/codemirror/lua_widget.ts +++ b/client/codemirror/lua_widget.ts @@ -318,7 +318,7 @@ export class LuaWidget extends WidgetType { '', listener: (e) => { e.stopPropagation(); - this.client.navigate(this.openRef!); + void this.client.navigate(this.openRef!); }, }, )); diff --git a/client/codemirror/table.ts b/client/codemirror/table.ts index 963d4cf5..51e93ae5 100644 --- a/client/codemirror/table.ts +++ b/client/codemirror/table.ts @@ -53,7 +53,7 @@ class TableViewWidget extends WidgetType { }); }); - expandMarkdown( + void expandMarkdown( client.space, client.currentName(), this.t, diff --git a/client/codemirror/widget_util.ts b/client/codemirror/widget_util.ts index d8358ea0..403f07f1 100644 --- a/client/codemirror/widget_util.ts +++ b/client/codemirror/widget_util.ts @@ -50,7 +50,7 @@ export function attachWidgetEventHandlers( } e.preventDefault(); e.stopPropagation(); - client.navigate( + void client.navigate( parseToRef(el.dataset.ref!), false, e.ctrlKey || e.metaKey, diff --git a/client/components/top_bar.tsx b/client/components/top_bar.tsx index cf3d5769..75479c4e 100644 --- a/client/components/top_bar.tsx +++ b/client/components/top_bar.tsx @@ -80,7 +80,7 @@ export function TopBar({ } }} onEnter={(newName) => { - onRename(newName); + void onRename(newName); }} editable={!client.ui.viewState.uiOptions.forcedROMode && !client.bootConfig.readOnly} diff --git a/client/data/data_augmenter.test.ts b/client/data/data_augmenter.test.ts index 7f6e867a..dadb0fff 100644 --- a/client/data/data_augmenter.test.ts +++ b/client/data/data_augmenter.test.ts @@ -15,7 +15,7 @@ test("Test data augmentation", async () => { name: "Mary", age: 5678, }; - ds.batchSet([{ + await ds.batchSet([{ key: ["john"], value: john, }, { diff --git a/client/data/mq.datastore.ts b/client/data/mq.datastore.ts index 22b67330..703fe9d0 100644 --- a/client/data/mq.datastore.ts +++ b/client/data/mq.datastore.ts @@ -50,7 +50,7 @@ export class QueueWorker { await this.callback(messages); } else { // No messages, wait to be woken up or a timeout - this.mq.eventHook.dispatchEvent( + void this.mq.eventHook.dispatchEvent( `mq:emptyQueue:${this.queue}`, this.queue, ); @@ -226,7 +226,7 @@ export class DataStoreMQ { ): QueueWorker { const worker = new QueueWorker(this, queue, options, callback); // Start the worker asynchronously - worker.run(); + void worker.run(); return worker; } diff --git a/client/data/object_index.ts b/client/data/object_index.ts index 9cac8005..148bbae9 100644 --- a/client/data/object_index.ts +++ b/client/data/object_index.ts @@ -67,7 +67,7 @@ export class ObjectIndex { }); // Handle initial index completion - this.hasFullIndexCompleted().then((hasCompleted) => { + void this.hasFullIndexCompleted().then((hasCompleted) => { if (!hasCompleted) { const emptyQueueHandler = async () => { console.log("Index queue empty, checking if index is complete"); @@ -84,7 +84,7 @@ export class ObjectIndex { emptyQueueHandler, ); // Trigger an editor:reloadState event to reload the editor state (render widgets etc.) - this.eventHook.dispatchEvent("editor:reloadState"); + void this.eventHook.dispatchEvent("editor:reloadState"); } }; this.eventHook.addLocalListener( @@ -158,7 +158,7 @@ export class ObjectIndex { await this.reindexSpace(space); // Dispatch an editor:reloadState event to reload the editor state (render widgets etc.) - this.eventHook.dispatchEvent("editor:reloadState"); + void this.eventHook.dispatchEvent("editor:reloadState"); } } diff --git a/client/editor_ui.tsx b/client/editor_ui.tsx index f092713d..82e319fc 100644 --- a/client/editor_ui.tsx +++ b/client/editor_ui.tsx @@ -65,7 +65,7 @@ export class MainUI { if (ev.touches.length === 3) { ev.stopPropagation(); ev.preventDefault(); - client.startCommandPalette(); + void client.startCommandPalette(); } }); @@ -95,8 +95,8 @@ export class MainUI { }, [viewState.current]); useEffect(() => { - this.client.rebuildEditorState(); - this.client.dispatchAppEvent("editor:modeswitch"); + void this.client.rebuildEditorState(); + void this.client.dispatchAppEvent("editor:modeswitch"); }, [viewState.uiOptions.vimMode]); useEffect(() => { @@ -220,7 +220,7 @@ export class MainUI { "This file cannot be edited, select your desired action.", ); } else { - client.navigate(ref); + void client.navigate(ref); } }); }} diff --git a/client/plugos/plug_compile.ts b/client/plugos/plug_compile.ts index fb7a0aa3..0ff707f5 100644 --- a/client/plugos/plug_compile.ts +++ b/client/plugos/plug_compile.ts @@ -196,6 +196,6 @@ export async function plugCompileCommand( info: info, }, ); - esbuild.stop(); + await esbuild.stop(); process.exit(0); } diff --git a/client/plugos/sandboxes/worker_sandbox.ts b/client/plugos/sandboxes/worker_sandbox.ts index a5ad5b41..f15cf3af 100644 --- a/client/plugos/sandboxes/worker_sandbox.ts +++ b/client/plugos/sandboxes/worker_sandbox.ts @@ -60,7 +60,7 @@ export class WorkerSandbox implements Sandbox { return resolve(); } - this.onMessage(ev.data); + void this.onMessage(ev.data); }; }), ]); diff --git a/client/plugos/syscalls/editor.ts b/client/plugos/syscalls/editor.ts index 73f94ec2..acbecde9 100644 --- a/client/plugos/syscalls/editor.ts +++ b/client/plugos/syscalls/editor.ts @@ -502,7 +502,7 @@ export function editorSyscalls(client: Client): SysCallMapping { key, value, }); - client.reloadEditor(); + void client.reloadEditor(); }, "editor.vimEx": (_ctx, exCommand: string) => { const cm = vimGetCm(client.editorView); @@ -592,7 +592,7 @@ export function editorSyscalls(client: Client): SysCallMapping { client.startPageNavigate(mode); }, "editor.openCommandPalette": () => { - client.startCommandPalette(); + void client.startCommandPalette(); }, "editor.deleteLine": () => { deleteLine(client.editorView); diff --git a/client/plugos/syscalls/sync.ts b/client/plugos/syscalls/sync.ts index 75832a70..353aa77b 100644 --- a/client/plugos/syscalls/sync.ts +++ b/client/plugos/syscalls/sync.ts @@ -8,11 +8,11 @@ export function syncSyscalls(client: Client): SysCallMapping { return client.fullSyncCompleted; }, "sync.performFileSync": (_ctx, path: string): Promise => { - client.postServiceWorkerMessage({ type: "perform-file-sync", path }); + void client.postServiceWorkerMessage({ type: "perform-file-sync", path }); return waitForServiceWorkerActivation(path); }, "sync.performSpaceSync": (): Promise => { - client.postServiceWorkerMessage({ type: "perform-space-sync" }); + void client.postServiceWorkerMessage({ type: "perform-space-sync" }); return waitForServiceWorkerActivation(); }, }; diff --git a/client/plugos/system.ts b/client/plugos/system.ts index 334407b4..ba98fb02 100644 --- a/client/plugos/system.ts +++ b/client/plugos/system.ts @@ -188,8 +188,8 @@ export class System extends EventEmitter> { if (!plug) { return; } - plug.stop(); - this.emit("plugUnloaded", name); + void plug.stop(); + void this.emit("plugUnloaded", name); this.plugs.delete(name); } diff --git a/client/service_worker.ts b/client/service_worker.ts index 7882b25b..b48b9f28 100644 --- a/client/service_worker.ts +++ b/client/service_worker.ts @@ -209,7 +209,7 @@ self.addEventListener("message", async (event: any) => { if (config.logPush) { setInterval(() => { - logger.postToServer(".logs", "service_worker"); + void logger.postToServer(".logs", "service_worker"); }, 1000); } @@ -264,7 +264,7 @@ self.addEventListener("message", async (event: any) => { proxyRouter.on({ observedRequest: (path) => { // This is triggered for the currently open file, we want to proactively sync it to keep it up to date - syncEngine.syncSingleFile(path); + void syncEngine.syncSingleFile(path); }, onlineStatusUpdated: (isOnline) => { broadcastMessage({ diff --git a/client/service_worker/proxy_router.ts b/client/service_worker/proxy_router.ts index f19cac68..a95d9ebf 100644 --- a/client/service_worker/proxy_router.ts +++ b/client/service_worker/proxy_router.ts @@ -42,9 +42,9 @@ export class ProxyRouter extends EventEmitter { ) { super(); // Actively check if we're online by pinging the server - this.checkOnline(); + void this.checkOnline(); setInterval(() => { - this.checkOnline(); + void this.checkOnline(); }, pingInterval); } @@ -87,7 +87,7 @@ export class ProxyRouter extends EventEmitter { // Otherwise we're not this.online = false; } finally { - this.emit("onlineStatusUpdated", this.online); + void this.emit("onlineStatusUpdated", this.online); } } else { console.info( @@ -255,7 +255,7 @@ export class ProxyRouter extends EventEmitter { if (request.headers.has("x-observing")) { setTimeout(() => { // Next tick - this.emit("observedRequest", path); + void this.emit("observedRequest", path); }); } return new Response(null, { diff --git a/client/service_worker/sync_engine.ts b/client/service_worker/sync_engine.ts index 52005173..a691595d 100644 --- a/client/service_worker/sync_engine.ts +++ b/client/service_worker/sync_engine.ts @@ -66,14 +66,14 @@ export class SyncEngine extends EventEmitter { this.spaceSync.on({ syncProgress: async (status, snapshot) => { - this.emit("syncProgress", status, snapshot); + void this.emit("syncProgress", status, snapshot); await this.saveSnapshot(snapshot); }, snapshotUpdated: this.saveSnapshot.bind(this), }); // Start the sync loop - this.run(); + void this.run(); } stop() { @@ -124,11 +124,11 @@ export class SyncEngine extends EventEmitter { const operations = await this.spaceSync.syncFiles(this.snapshot); if (operations !== -1) { // emit successful sync event (not when operations === -1, because that means another sync was ongoing) - this.emit("spaceSyncComplete", operations); + void this.emit("spaceSyncComplete", operations); } return operations; } catch (e) { - this.emit("syncError", e); + void this.emit("syncError", e); throw e; } } @@ -139,10 +139,10 @@ export class SyncEngine extends EventEmitter { path, this.snapshot, ); - this.emit("fileSyncComplete", path, operations); + void this.emit("fileSyncComplete", path, operations); return operations; } catch (e) { - this.emit("syncError", e); + void this.emit("syncError", e); throw e; } } @@ -193,7 +193,7 @@ export class SyncEngine extends EventEmitter { if (operations > 0) { // Something happened -> conflict copy generated, let's report it - this.emit("syncConflict", name); + void this.emit("syncConflict", name); } return operations; diff --git a/client/space_lua/aggregates.ts b/client/space_lua/aggregates.ts index 6046fbd3..254765ef 100644 --- a/client/space_lua/aggregates.ts +++ b/client/space_lua/aggregates.ts @@ -118,12 +118,12 @@ const noCtx = {}; function buildAggCtx(name: string): LuaTable { const ctx = new LuaTable(); - ctx.rawSet("name", name); + void ctx.rawSet("name", name); const clientConfig = globalThis.client?.config; const aggConfig = clientConfig ? clientConfig.get(`aggregateConfig.${name}`, {}) : {}; - ctx.rawSet("config", aggConfig); + void ctx.rawSet("config", aggConfig); return ctx; } diff --git a/client/space_lua/eval.ts b/client/space_lua/eval.ts index fb933482..03da82d5 100644 --- a/client/space_lua/eval.ts +++ b/client/space_lua/eval.ts @@ -788,13 +788,13 @@ export function evalExpression( switch (field.type) { case "PropField": { const value = await evalExpression(field.value, env, sf); - table.set(field.key, singleResult(value), sf); + void table.set(field.key, singleResult(value), sf); break; } case "DynamicField": { const key = await evalExpression(field.key, env, sf); const value = await evalExpression(field.value, env, sf); - table.set(singleResult(key), singleResult(value), sf); + void table.set(singleResult(key), singleResult(value), sf); break; } case "ExpressionField": { diff --git a/client/space_lua/query_collection.ts b/client/space_lua/query_collection.ts index a823c059..55b77c89 100644 --- a/client/space_lua/query_collection.ts +++ b/client/space_lua/query_collection.ts @@ -330,14 +330,14 @@ export async function evalExpressionWithAggregates( case "PropField": { const pf = field as LuaPropField; const value = await recurse(pf.value); - table.set(pf.key, value, sf); + void table.set(pf.key, value, sf); break; } case "DynamicField": { const df = field as LuaDynamicField; const key = await evalExpression(df.key, env, sf); const value = await recurse(df.value); - table.set(key, value, sf); + void table.set(key, value, sf); break; } case "ExpressionField": { @@ -447,14 +447,14 @@ function normalizeSelectResults(results: any[]): any[] { const rebuilt = new LuaTable(); for (const k of canonicalKeys) { const v = item.rawGet(k); - rebuilt.rawSet( + void rebuilt.rawSet( k, (v === undefined || v === null) ? LIQ_NULL : v, ); } for (const k of luaKeys(item)) { if (typeof k !== "string") { - rebuilt.rawSet(k, item.rawGet(k)); + void rebuilt.rawSet(k, item.rawGet(k)); } } results[i] = rebuilt; @@ -714,7 +714,7 @@ export async function applyQuery( } // Additionally set named fields for Variable/PropertyAccess exprs for (const name in keyRecord) { - kt.rawSet(name, keyRecord[name]); + void kt.rawSet(name, keyRecord[name]); } keyVal = kt; } @@ -741,8 +741,8 @@ export async function applyQuery( ); } const row = new LuaTable(); - row.rawSet("key", key); - row.rawSet("group", groupTable); + void row.rawSet("key", key); + void row.rawSet("group", groupTable); results.push(row); } } diff --git a/client/space_lua/runtime.ts b/client/space_lua/runtime.ts index 098dcc19..5a183dbe 100644 --- a/client/space_lua/runtime.ts +++ b/client/space_lua/runtime.ts @@ -1643,7 +1643,7 @@ export function getMetatable( } const stringMetatable = new LuaTable(); - stringMetatable.set("__index", (globalEnv as any).get("string")); + void stringMetatable.set("__index", (globalEnv as any).get("string")); thread.setLocal("_STRING_MT", stringMetatable); return stringMetatable; @@ -1673,24 +1673,24 @@ export function jsToLuaValue(value: any): any { const regexMatch = value as RegExpMatchArray; const regexMatchTable = new LuaTable(); for (let i = 0; i < regexMatch.length; i++) { - regexMatchTable.set(i + 1, regexMatch[i]); + void regexMatchTable.set(i + 1, regexMatch[i]); } - regexMatchTable.set("index", regexMatch.index); - regexMatchTable.set("input", regexMatch.input); - regexMatchTable.set("groups", regexMatch.groups); + void regexMatchTable.set("index", regexMatch.index); + void regexMatchTable.set("input", regexMatch.input); + void regexMatchTable.set("groups", regexMatch.groups); return regexMatchTable; } if (Array.isArray(value)) { const table = new LuaTable(); for (let i = 0; i < value.length; i++) { - table.set(i + 1, jsToLuaValue(value[i])); + void table.set(i + 1, jsToLuaValue(value[i])); } return table; } if (typeof value === "object") { const table = new LuaTable(); for (const key in value) { - table.set(key, jsToLuaValue((value as any)[key])); + void table.set(key, jsToLuaValue((value as any)[key])); } return table; } diff --git a/client/space_lua/stdlib/os.ts b/client/space_lua/stdlib/os.ts index 9af8f75b..b2aabdd4 100644 --- a/client/space_lua/stdlib/os.ts +++ b/client/space_lua/stdlib/os.ts @@ -138,7 +138,7 @@ function dateTable(d: Date, utc: boolean): LuaTable { }); if (!utc) { - tbl.rawSet("isdst", isDST(d)); + void tbl.rawSet("isdst", isDST(d)); } return tbl; diff --git a/client/space_lua/stdlib/table.ts b/client/space_lua/stdlib/table.ts index d1fbf70a..73bce11f 100644 --- a/client/space_lua/stdlib/table.ts +++ b/client/space_lua/stdlib/table.ts @@ -399,7 +399,7 @@ export const tableApi = new LuaTable({ for (let i = 0; i < n; i++) { await luaSet(tbl, i + 1, args[i], sf); } - tbl.rawSet("n", n); + void tbl.rawSet("n", n); return tbl; }), diff --git a/client/spaces/sync.ts b/client/spaces/sync.ts index 66d7b0c9..a4a49386 100644 --- a/client/spaces/sync.ts +++ b/client/spaces/sync.ts @@ -153,7 +153,7 @@ export class SpaceSync extends EventEmitter { } finally { this.isSyncing = false; if (operations > 0) { - this.emit("snapshotUpdated", snapshot); + void this.emit("snapshotUpdated", snapshot); } } @@ -210,7 +210,7 @@ export class SpaceSync extends EventEmitter { } finally { this.isSyncing = false; if (operations > 0) { - this.emit("snapshotUpdated", snapshot); + void this.emit("snapshotUpdated", snapshot); } } diff --git a/package.json b/package.json index 8b5eb0d9..f8409fde 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@silverbulletmd/silverbullet", - "version": "2.4.3", + "version": "2.5.3", "type": "module", "description": "A self-hosted, web-based note taking app", "publishConfig": { diff --git a/plug-api/lib/async.ts b/plug-api/lib/async.ts index 42a7b9c2..6b111782 100644 --- a/plug-api/lib/async.ts +++ b/plug-api/lib/async.ts @@ -58,7 +58,7 @@ export class PromiseQueue { return new Promise((resolve, reject) => { this.queue.push({ fn, resolve, reject }); if (!this.processing) { - this.process(); + void this.process(); } }); } @@ -79,7 +79,7 @@ export class PromiseQueue { reject(error); } - this.process(); // Continue processing the next promise in the queue + void this.process(); // Continue processing the next promise in the queue } } diff --git a/plugs/editor/editor.ts b/plugs/editor/editor.ts index 3b1a5e76..edd2a8cb 100644 --- a/plugs/editor/editor.ts +++ b/plugs/editor/editor.ts @@ -22,7 +22,7 @@ export async function setEditorMode() { await editor.alert( "Client needs reloading to update the cache, required syscalls are not available in this version. This message may appear a few times. Reloading now.", ); - editor.reloadUI(); + void editor.reloadUI(); } if (await clientStore.get("vimMode")) { @@ -115,7 +115,7 @@ export async function moveToPosCommand() { } posString = posString.trim(); if (posString === "") { - editor.flashNotification("Must provide a position.", "error"); + void editor.flashNotification("Must provide a position.", "error"); return; } const pos = +posString; @@ -145,7 +145,7 @@ export async function moveToLineCommand() { } lineString = lineString.trim(); if (lineString === "") { - editor.flashNotification("Must provide a line number.", "error"); + void editor.flashNotification("Must provide a line number.", "error"); return; } // Match sequence of digits at the start, optionally another sequence @@ -178,7 +178,7 @@ export async function reloadSystem() { } export function refreshAllWidgets() { - codeWidget.refreshAll(); + void codeWidget.refreshAll(); } export async function findInPageCommand() { diff --git a/plugs/editor/outline.ts b/plugs/editor/outline.ts index 5b9c8587..23811f5c 100644 --- a/plugs/editor/outline.ts +++ b/plugs/editor/outline.ts @@ -11,7 +11,7 @@ export async function moveItemUp() { } catch { // If `determineItemBounds()` throws, that likely means the cursor is NOT in a bullet list, // so we fall back to `moveLineUp()` - editor.moveLineUp(); + void editor.moveLineUp(); return; } let previousItemBounds: ReturnType | undefined; @@ -83,7 +83,7 @@ export async function moveItemDown() { } catch { // If `determineItemBounds()` throws, that likely means the cursor is NOT in a bullet list, // so we fall back to `moveLineDown()` - editor.moveLineDown(); + void editor.moveLineDown(); return; } let nextItemBounds: ReturnType | undefined; diff --git a/plugs/editor/page.ts b/plugs/editor/page.ts index d4a0f9a6..54fd94ab 100644 --- a/plugs/editor/page.ts +++ b/plugs/editor/page.ts @@ -37,7 +37,7 @@ export async function copyPage( } newName = newName.trim(); if (newName === "") { - editor.flashNotification("Must provide a non-empty page name.", "error"); + void editor.flashNotification("Must provide a non-empty page name.", "error"); return; } diff --git a/plugs/editor/upload.ts b/plugs/editor/upload.ts index 11fadd0a..32589e49 100644 --- a/plugs/editor/upload.ts +++ b/plugs/editor/upload.ts @@ -33,7 +33,7 @@ export async function saveFile(file: UploadFile) { ); } if (file.content.length > maxSize * 1024 * 1024) { - editor.flashNotification( + void editor.flashNotification( `Document is too large, maximum is ${maxSize}MiB`, "error", ); @@ -53,7 +53,7 @@ export async function saveFile(file: UploadFile) { } desiredFilePath = desiredFilePath.trim(); if (!isValidPath(desiredFilePath)) { - editor.flashNotification(invalidPathMessage, "error"); + void editor.flashNotification(invalidPathMessage, "error"); return; } @@ -75,12 +75,12 @@ export async function saveFile(file: UploadFile) { // Unlike the initial filename prompt, we're inside a workflow here // and should be explicit that the user action cancelled the whole // operation. - editor.flashNotification("Upload cancelled by user", "info"); + void editor.flashNotification("Upload cancelled by user", "info"); return; } confirmedFilePath = confirmedFilePath.trim(); if (!isValidPath(confirmedFilePath)) { - editor.flashNotification(invalidPathMessage, "error"); + void editor.flashNotification(invalidPathMessage, "error"); return; } if (desiredFilePath === confirmedFilePath) { @@ -112,7 +112,7 @@ export async function saveFile(file: UploadFile) { if (file.contentType.startsWith("image/")) { documentMarkdown = `!${documentMarkdown}`; } - editor.insertAtCursor(documentMarkdown); + void editor.insertAtCursor(documentMarkdown); } } diff --git a/plugs/emoji/emoji.ts b/plugs/emoji/emoji.ts index 7f7630d8..4578c479 100644 --- a/plugs/emoji/emoji.ts +++ b/plugs/emoji/emoji.ts @@ -11,7 +11,7 @@ const emojis = emojiBlob.split("|").map((line) => line.split(" ")); export function emojiCompleter( { linePrefix, pos, parentNodes }: CompleteEvent, ) { - updateConfig(); // no need to await, will be ready for completion by next keystrokes + void updateConfig(); // no need to await, will be ready for completion by next keystrokes const match = /:([\w]+)$/.exec(linePrefix); if (!match) { diff --git a/plugs/image-viewer/viewer.ts b/plugs/image-viewer/viewer.ts index 120b8a4e..9d4d087d 100644 --- a/plugs/image-viewer/viewer.ts +++ b/plugs/image-viewer/viewer.ts @@ -166,5 +166,5 @@ globalThis.silverbullet.addEventListener("flash-info", () => { } export function showInfoMessage() { - editor.sendMessage("flash-info"); + void editor.sendMessage("flash-info"); } diff --git a/plugs/index/refactor.ts b/plugs/index/refactor.ts index f5858525..245753ea 100644 --- a/plugs/index/refactor.ts +++ b/plugs/index/refactor.ts @@ -40,7 +40,7 @@ export async function renamePageCommand(cmdDef: any) { } newName = newName.trim(); if (newName === "") { - editor.flashNotification("Must provide a non-empty page title.", "error"); + void editor.flashNotification("Must provide a non-empty page title.", "error"); return false; } const pageList: [string, string][] = [[`${oldName}.md`, `${newName}.md`]]; @@ -77,7 +77,7 @@ export async function renamePageLinkCommand() { } newName = newName.trim(); if (newName === "") { - editor.flashNotification("Must provide a non-empty page title.", "error"); + void editor.flashNotification("Must provide a non-empty page title.", "error"); return false; } const pageList: [string, string][] = [[`${oldName}.md`, `${newName}.md`]]; @@ -101,7 +101,7 @@ export async function renameDocumentCommand(cmdDef: any) { } newName = newName.trim(); if (newName === "") { - editor.flashNotification( + void editor.flashNotification( "Must provide a non-empty document name.", "error", ); @@ -325,7 +325,7 @@ export async function renamePrefixCommand(cmdDef: any) { // actually want to add or remove white space. They can also input an empty // string for the new prefix to remove the old prefix. if (oldPrefix === "") { - editor.flashNotification("Must provide a non-empty prefix.", "error"); + void editor.flashNotification("Must provide a non-empty prefix.", "error"); return false; } const newPrefix = cmdDef.newPrefix ?? @@ -377,7 +377,7 @@ export async function extractToPageCommand() { } newName = newName.trim(); if (newName === "") { - editor.flashNotification("Must provide a non-empty page title.", "error"); + void editor.flashNotification("Must provide a non-empty page title.", "error"); } try { diff --git a/plugs/index/task.ts b/plugs/index/task.ts index f44f84a9..ef123dea 100644 --- a/plugs/index/task.ts +++ b/plugs/index/task.ts @@ -223,7 +223,7 @@ export async function updateTaskState( taskStateNode.children![1].text = newState; text = renderToText(referenceMdTree); await space.writePage(pageName, text); - sync.performFileSync(`${pageName}.md`); + void sync.performFileSync(`${pageName}.md`); } } @@ -292,7 +292,7 @@ export async function taskCycleCommand() { return; } - convertListItemToTask(listItem); + await convertListItemToTask(listItem); } export async function removeCompletedTasksCommand() { diff --git a/plugs/plug-manager/plugmanager.ts b/plugs/plug-manager/plugmanager.ts index f0fcc38a..6dc4c0d4 100644 --- a/plugs/plug-manager/plugmanager.ts +++ b/plugs/plug-manager/plugmanager.ts @@ -138,9 +138,9 @@ export async function updatePlugsCommand() { } } await editor.flashNotification("All done!"); - system.reloadPlugs(); + void system.reloadPlugs(); } catch (e: any) { - editor.flashNotification(`Error updating plugs: ${e.message}`, "error"); + void editor.flashNotification(`Error updating plugs: ${e.message}`, "error"); } } diff --git a/plugs/sync/sync.ts b/plugs/sync/sync.ts index 7f3dd262..aea3e130 100644 --- a/plugs/sync/sync.ts +++ b/plugs/sync/sync.ts @@ -23,7 +23,7 @@ export async function spaceSyncComplete(message: { operations: number }) { await space.listFiles(); } - index.ensureFullIndex(); + void index.ensureFullIndex(); } export async function updateSyncStatus( diff --git a/version.ts b/version.ts index e6e70f72..c5193f1b 100644 --- a/version.ts +++ b/version.ts @@ -1 +1 @@ -export const version = "2.5.2"; +export const version = "2.5.3";