build: svelte-check fails on warnings; the harness gives every node a parentId

Svelte's a11y_* checks are compiler warnings, and a warning never failed
anything: `npm run check` now runs svelte-check with --fail-on-warnings. It is
the only lint that reads the markup (Biome skips .svelte). The suite is at
zero warnings; the two deliberate exceptions carry a svelte-ignore.

scripts/screenshots.mjs built its sample tree without parentId, which Chrome
gives every node but the root. In the harness nothing could be placed beside
a sibling and the toolbar's Sort stayed disabled on a bookmark — found while
driving Alt+Up/Down through it.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
poli0981andClaude Fable 5.2 committed 2026-11-10 11:18:58 +07:00
1 parent 9d4458ae4b
commit 8d9739cab4
5 files changed
+16 -4

No files matched your search

+1 -1
View File
@@ -63,7 +63,7 @@
"dev:firefox": "wxt -b firefox", // build sanity only, no store release
"build": "wxt build",
"zip": "wxt zip",
"check": "svelte-check --tsconfig ./tsconfig.json && tsc --noEmit && tsc -p tsconfig.scripts.json",
"check": "svelte-check --tsconfig ./tsconfig.json --fail-on-warnings && tsc --noEmit && tsc -p tsconfig.scripts.json",
// TS 6 API, the TS 7 tsc, then scripts/*.mjs via checkJs
"lint": "biome check .",
"lint:fix": "biome check --write .",
+6
View File
@@ -78,6 +78,12 @@ rather than assign `undefined`. Build nodes with conditional spreads
(`switch-every-tab-hotkey`) excludes `.svelte` and `.css` instead, and we
follow it rather than putting the build on an experimental flag.
**`svelte-check` is the authority** for everything inside `.svelte`.
Since v1.2.1 it runs with **`--fail-on-warnings`**: the Svelte compiler's
accessibility warnings (`a11y_*` — a click handler with no key handler, a
control with no label) are warnings, and through 1.2.0 a warning never
failed anything. It is the only lint that reads the markup. A deliberate
exception takes a `<!-- svelte-ignore a11y_… -->` with its reason beside it;
there are two, on `Modal`'s backdrop click and on the tree's `<ul>`.
- **Markdown and YAML are excluded since Biome 2.6**, which started formatting
both. The docs and workflow files are laid out by hand (long explanatory
comments, deliberate wrapping); letting a formatter own them would turn every
+2 -1
View File
@@ -64,7 +64,8 @@ Three jobs. The two whose names branch protection requires (§5) are
- **`quality` — "Quality gates".** Local, because the ops reusable runs no
quality gates at all (§1). In order: `lint`, `check` (svelte-check on the
TS 6 API, then the TS 7 `tsc`), `knip`, `coverage` (`11 §1` thresholds),
TS 6 API — failing on warnings too since v1.2.1, which is what makes Svelte's
`a11y_*` checks a gate, `10 §3` — then the TS 7 `tsc`), `knip`, `coverage` (`11 §1` thresholds),
`guard` (`08 §3`), `npm audit --omit=dev --audit-level=low` (the
zero-runtime-dependencies claim, `09 T5`), `build`, `check:manifest`. The last
two exist because the unit test over `wxt.config.ts` proves what we *asked*
+1 -1
View File
@@ -23,7 +23,7 @@
"dev:firefox": "wxt -b firefox",
"build": "wxt build",
"zip": "wxt zip",
"check": "svelte-check --tsconfig ./tsconfig.json && tsc --noEmit && tsc -p tsconfig.scripts.json",
"check": "svelte-check --tsconfig ./tsconfig.json --fail-on-warnings && tsc --noEmit && tsc -p tsconfig.scripts.json",
"lint": "biome check .",
"lint:fix": "biome check --write .",
"knip": "knip",
+6 -1
View File
@@ -81,6 +81,11 @@ function shim() {
] },
{ id: '3', title: 'Mobile bookmarks', children: [b('Read later', 'https://later.example.com/')] },
] }];
// Chrome gives every node but the root a parentId, and the product relies on
// it: without one, nothing can be placed beside a sibling (drag, Alt+↑/↓) and
// the toolbar's Sort has no folder to act on.
const adopt = (nodes, parentId) => { for (const n of nodes) { if (parentId !== undefined) n.parentId = parentId; if (n.children) adopt(n.children, n.id); } };
adopt(tree);
const byId = (id, nodes = tree) => { for (const n of nodes) { if (n.id === id) return n; const hit = n.children && byId(id, n.children); if (hit) return hit; } };
const parentOf = (id, nodes = tree) => { for (const n of nodes) { if (n.children?.some((c) => c.id === id)) return n; const hit = n.children && parentOf(id, n.children); if (hit) return hit; } };
const clone = (v) => structuredClone(v);
@@ -89,7 +94,7 @@ function shim() {
getTree: async () => clone(tree),
create: async ({ parentId, title, url, index }) => { const p = byId(parentId); const n = url ? { id: String(next++), parentId, title, url, dateAdded: Date.now() } : { id: String(next++), parentId, title, dateAdded: Date.now(), children: [] }; const at = index ?? p.children.length; p.children.splice(at, 0, n); events.onCreated.fire(n.id, clone({ ...n, index: at })); return clone(n); },
update: async (id, changes) => { Object.assign(byId(id), changes); events.onChanged.fire(id, changes); },
move: async (id, { parentId, index }) => { const from = parentOf(id); const n = byId(id); const old = from.children.indexOf(n); from.children.splice(old, 1); const to = byId(parentId ?? from.id); let at = index ?? to.children.length; if (to === from && at > old) at--; to.children.splice(at, 0, n); events.onMoved.fire(id, { parentId: to.id, index: at, oldParentId: from.id, oldIndex: old }); },
move: async (id, { parentId, index }) => { const from = parentOf(id); const n = byId(id); const old = from.children.indexOf(n); from.children.splice(old, 1); const to = byId(parentId ?? from.id); let at = index ?? to.children.length; if (to === from && at > old) at--; to.children.splice(at, 0, n); n.parentId = to.id; events.onMoved.fire(id, { parentId: to.id, index: at, oldParentId: from.id, oldIndex: old }); },
remove: async (id) => { const p = parentOf(id); p.children = p.children.filter((c) => c.id !== id); events.onRemoved.fire(id, {}); },
};
bookmarks.removeTree = bookmarks.remove;