lint fixes

This commit is contained in:
Zef Hemel
2026-05-31 13:01:33 +02:00
parent 7316c1bdd2
commit 605382578c
6 changed files with 11 additions and 11 deletions
+1 -1
View File
@@ -362,7 +362,7 @@ async function cachedFetch(path: string): Promise<string> {
// 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);
+1 -1
View File
@@ -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})`,
+4 -4
View File
@@ -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);
}
}
}
+3 -3
View File
@@ -73,7 +73,7 @@ async function readFullIndexCompleted(page: Page): Promise<boolean | undefined>
*/
async function waitForWidgetsReady(page: Page, timeoutMs = 15_000): Promise<void> {
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`,
},
});
+1 -1
View File
@@ -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);
}
+1 -1
View File
@@ -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 (