diff --git a/client/boot.ts b/client/boot.ts index 16fb076d..00958bf4 100644 --- a/client/boot.ts +++ b/client/boot.ts @@ -362,7 +362,7 @@ async function cachedFetch(path: string): Promise { // Persist to localStorage localStorage.setItem(cacheKey, text); return text; - } catch (e: any) { + } catch { console.info("Falling back to cache for", path); // We may be offline, let's see if we have a cached copy const text = localStorage.getItem(cacheKey); diff --git a/client/data/object_index.ts b/client/data/object_index.ts index 23a789ed..e4228669 100644 --- a/client/data/object_index.ts +++ b/client/data/object_index.ts @@ -205,7 +205,7 @@ export class ObjectIndex { } subPages(pageName: string): LuaQueryCollection { - const prefix = JSON.stringify(pageName + "/"); + const prefix = JSON.stringify(`${pageName}/`); return this.filteredTag( "page", (varName) => `string.startsWith(${varName}.name, ${prefix})`, diff --git a/client/lib/fuzzy_search.test.ts b/client/lib/fuzzy_search.test.ts index 00f23526..86460dad 100644 --- a/client/lib/fuzzy_search.test.ts +++ b/client/lib/fuzzy_search.test.ts @@ -25,23 +25,23 @@ function assertSearch( JSON.stringify(names, null, 2) }`; if (expected.resultCount !== undefined) { - expect(results.length, "result count" + detail).toEqual( + expect(results.length, `result count${detail}`).toEqual( expected.resultCount, ); } if (expected.topMatch !== undefined) { - expect(names[0], "top match" + detail).toEqual(expected.topMatch); + expect(names[0], `top match${detail}`).toEqual(expected.topMatch); } if (expected.mustIncludeInTopN) { const n = expected.n ?? expected.mustIncludeInTopN.length; const topN = names.slice(0, n); for (const name of expected.mustIncludeInTopN) { - expect(topN, `expected ${name} in top ${n}` + detail).toContain(name); + expect(topN, `expected ${name} in top ${n}${detail}`).toContain(name); } } if (expected.mustExclude) { for (const name of expected.mustExclude) { - expect(names, `expected ${name} excluded` + detail).not.toContain(name); + expect(names, `expected ${name} excluded${detail}`).not.toContain(name); } } } diff --git a/e2e/index-upgrade.test.ts b/e2e/index-upgrade.test.ts index 3a9d174b..b5e6ce7b 100644 --- a/e2e/index-upgrade.test.ts +++ b/e2e/index-upgrade.test.ts @@ -73,7 +73,7 @@ async function readFullIndexCompleted(page: Page): Promise */ async function waitForWidgetsReady(page: Page, timeoutMs = 15_000): Promise { const deadline = Date.now() + timeoutMs; - let last: unknown = undefined; + let last: unknown ; while (Date.now() < deadline) { last = await page.evaluate(() => { const client = (globalThis as any).client; @@ -145,7 +145,7 @@ test.describe("index version upgrade (service worker disabled)", () => { "index.md": "# Index\nFirst page in the upgrade-test space.", "Other.md": "# Other\nSee [[index]] for the entry point.", "Styles.md": - "# Styles\n\n```space-style\n/* " + SPACE_STYLE_MARKER + " */\n```\n", + `# Styles\n\n\`\`\`space-style\n/* ${SPACE_STYLE_MARKER} */\n\`\`\`\n`, }, }); @@ -210,7 +210,7 @@ test.describe("index version upgrade (service worker enabled)", () => { "index.md": "# Index\nFirst page in the SW-enabled upgrade test.", "Other.md": "# Other\nLink back to [[index]].", "Styles.md": - "# Styles\n\n```space-style\n/* " + SPACE_STYLE_MARKER + " */\n```\n", + `# Styles\n\n\`\`\`space-style\n/* ${SPACE_STYLE_MARKER} */\n\`\`\`\n`, }, }); diff --git a/plugs/editor/complete.ts b/plugs/editor/complete.ts index 6f6c6b3b..a8550019 100644 --- a/plugs/editor/complete.ts +++ b/plugs/editor/complete.ts @@ -9,7 +9,7 @@ import type { CompleteEvent } from "@silverbulletmd/silverbullet/type/client"; // Map a page's last-modified time to a small, monotone-decreasing boost function recencyToBoost(lastModified: string): number { const days = (Date.now() - new Date(lastModified).getTime()) / 86_400_000; - if (isNaN(days)) return -Infinity; // unknown timestamp → sort to bottom + if (Number.isNaN(days)) return -Infinity; // unknown timestamp → sort to bottom if (days < 0) return 0; // future timestamp (clock skew) → treat as "now" return -Math.log2(days + 1); } diff --git a/plugs/index/index_stats.ts b/plugs/index/index_stats.ts index f5604532..64d7d9c4 100644 --- a/plugs/index/index_stats.ts +++ b/plugs/index/index_stats.ts @@ -118,7 +118,7 @@ async function main() { console.log(` ${tag.padEnd(20)} ${String(count).padStart(5)} (${pct}%)`); } - const relTotal = r.byTag["relation"] ?? 0; + const relTotal = r.byTag.relation ?? 0; if (relTotal > 0) { console.log(`\n=== RELATION RECORDS BY KIND ===`); for (