From acdf7d11d5ceb88145136641ecd1817f44a3036f Mon Sep 17 00:00:00 2001 From: dawn Date: Sat, 29 Aug 2026 17:45:56 +0900 Subject: [PATCH] web/{api,components,routes},bobbin/crates/edge-index: format, fixup eslint Signed-off-by: dawn --- bobbin/crates/edge-index/src/lib.rs | 1 - web/src/lib/api/search.test.ts | 4 +- web/src/lib/api/signup.test.ts | 91 +++---- web/src/lib/api/signup.ts | 4 +- .../notifications/NotificationItem.svelte | 2 + .../notifications/NotificationToolbar.svelte | 7 +- .../components/profile/ProfileChrome.svelte | 2 +- .../repo/SubscribeButton.stories.svelte | 35 +-- .../components/repo/SubscribeButton.svelte | 222 ++++++++++-------- .../components/repo/issues/IssueForm.svelte | 1 - .../lib/components/search/SearchBar.svelte | 24 +- web/src/lib/components/shell/Topbar.svelte | 6 +- web/src/lib/components/ui/Input.svelte | 4 +- web/src/lib/components/ui/Turnstile.svelte | 4 +- web/src/lib/components/welcome/Steps.svelte | 2 +- web/src/routes/notifications/+page.svelte | 4 +- web/src/routes/signup/+page.svelte | 4 +- web/src/routes/signup/verify/+page.svelte | 6 +- 18 files changed, 224 insertions(+), 199 deletions(-) diff --git a/bobbin/crates/edge-index/src/lib.rs b/bobbin/crates/edge-index/src/lib.rs index d0667afcb..b92492b1f 100644 --- a/bobbin/crates/edge-index/src/lib.rs +++ b/bobbin/crates/edge-index/src/lib.rs @@ -13,7 +13,6 @@ use jacquard_common::DefaultStr; use jacquard_common::deps::smol_str::SmolStr; use jacquard_common::types::did::Did; use jacquard_common::types::nsid::Nsid; -use jacquard_common::deps::smol_str::SmolStr; use jacquard_common::types::string::AtUri; use lasso::{Key, Spur, ThreadedRodeo}; use scc::HashMap as SccMap; diff --git a/web/src/lib/api/search.test.ts b/web/src/lib/api/search.test.ts index 984ccdcde..e68b33214 100644 --- a/web/src/lib/api/search.test.ts +++ b/web/src/lib/api/search.test.ts @@ -168,7 +168,9 @@ describe("searchCode", () => { expect(minted.get("aud")).toBe("did:web:127.0.0.1%3A8090"); expect(minted.get("lxm")).toBe(NSID); - const headers = new Headers((fetchMock.mock.calls[0][1] as RequestInit | undefined)?.headers); + const headers = new Headers( + (fetchMock.mock.calls[0][1] as RequestInit | undefined)?.headers + ); expect(headers.get("authorization")).toBe("Bearer jwt-abc"); }); }); diff --git a/web/src/lib/api/signup.test.ts b/web/src/lib/api/signup.test.ts index 628d84be1..c7ed3492c 100644 --- a/web/src/lib/api/signup.test.ts +++ b/web/src/lib/api/signup.test.ts @@ -23,14 +23,18 @@ describe("beginSignup", () => { }); it("surfaces the server's error message", async () => { - const fetchMock = vi - .fn() - .mockResolvedValue( - new Response(JSON.stringify({ error: "EmailAlreadyRegistered", message: "an account already exists for this email" }), { + const fetchMock = vi.fn().mockResolvedValue( + new Response( + JSON.stringify({ + error: "EmailAlreadyRegistered", + message: "an account already exists for this email" + }), + { status: 409, headers: { "content-type": "application/json" } - }) - ); + } + ) + ); await expect( beginSignup("https://deliberi.test", "a@b.co", "t", fetchMock) ).rejects.toThrow("an account already exists for this email"); @@ -65,14 +69,19 @@ describe("resendSignup", () => { }); it("surfaces the server's message when nothing is pending", async () => { - const fetchMock = vi - .fn() - .mockResolvedValue( - new Response(JSON.stringify({ error: "NoPendingSignup", message: "there is no pending signup for this email; start again from the signup page" }), { + const fetchMock = vi.fn().mockResolvedValue( + new Response( + JSON.stringify({ + error: "NoPendingSignup", + message: + "there is no pending signup for this email; start again from the signup page" + }), + { status: 404, headers: { "content-type": "application/json" } - }) - ); + } + ) + ); await expect(resendSignup("https://deliberi.test", "a@b.co", fetchMock)).rejects.toThrow( "there is no pending signup for this email" ); @@ -81,14 +90,12 @@ describe("resendSignup", () => { describe("completeSignup", () => { it("posts token, username, and password and parses did/handle", async () => { - const fetchMock = vi - .fn() - .mockResolvedValue( - new Response(JSON.stringify({ did: "did:plc:x", handle: "alice.tngl.sh" }), { - status: 200, - headers: { "content-type": "application/json" } - }) - ); + const fetchMock = vi.fn().mockResolvedValue( + new Response(JSON.stringify({ did: "did:plc:x", handle: "alice.tngl.sh" }), { + status: 200, + headers: { "content-type": "application/json" } + }) + ); const out = await completeSignup( "https://deliberi.test", "tok-123", @@ -110,14 +117,18 @@ describe("completeSignup", () => { }); it("surfaces the server's error message", async () => { - const fetchMock = vi - .fn() - .mockResolvedValue( - new Response(JSON.stringify({ error: "InvalidCode", message: "invalid or expired verification link" }), { + const fetchMock = vi.fn().mockResolvedValue( + new Response( + JSON.stringify({ + error: "InvalidCode", + message: "invalid or expired verification link" + }), + { status: 400, headers: { "content-type": "application/json" } - }) - ); + } + ) + ); await expect( completeSignup("https://deliberi.test", "bad", "alice", "password1234", fetchMock) ).rejects.toThrow("invalid or expired verification link"); @@ -133,28 +144,24 @@ describe("completeSignup", () => { }); it("surfaces the error code when the payload omits the message", async () => { - const fetchMock = vi - .fn() - .mockResolvedValue( - new Response(JSON.stringify({ error: "InvalidCode" }), { - status: 400, - headers: { "content-type": "application/json" } - }) - ); + const fetchMock = vi.fn().mockResolvedValue( + new Response(JSON.stringify({ error: "InvalidCode" }), { + status: 400, + headers: { "content-type": "application/json" } + }) + ); await expect( completeSignup("https://deliberi.test", "bad", "alice", "password1234", fetchMock) ).rejects.toThrow("InvalidCode"); }); it("rejects a 2xx payload missing the handle", async () => { - const fetchMock = vi - .fn() - .mockResolvedValue( - new Response(JSON.stringify({ did: "did:plc:x" }), { - status: 200, - headers: { "content-type": "application/json" } - }) - ); + const fetchMock = vi.fn().mockResolvedValue( + new Response(JSON.stringify({ did: "did:plc:x" }), { + status: 200, + headers: { "content-type": "application/json" } + }) + ); await expect( completeSignup("https://deliberi.test", "tok", "alice", "password1234", fetchMock) ).rejects.toThrow(/invalid response/); diff --git a/web/src/lib/api/signup.ts b/web/src/lib/api/signup.ts index a1643ce25..eb8db2291 100644 --- a/web/src/lib/api/signup.ts +++ b/web/src/lib/api/signup.ts @@ -40,7 +40,9 @@ export const resendSignup = async ( body: JSON.stringify({ email }) }); if (!response.ok) { - throw new Error(await errorMessage(response, `could not resend signup: ${response.status}`)); + throw new Error( + await errorMessage(response, `could not resend signup: ${response.status}`) + ); } }; diff --git a/web/src/lib/components/notifications/NotificationItem.svelte b/web/src/lib/components/notifications/NotificationItem.svelte index f8d5e9612..f307ff16d 100644 --- a/web/src/lib/components/notifications/NotificationItem.svelte +++ b/web/src/lib/components/notifications/NotificationItem.svelte @@ -77,6 +77,8 @@ }; + +