chore: add typed ESLint checks #18

Refs WealthLedger/main#18. Keep Biome; add no Prettier dependencies.
This commit is contained in:
2026-09-28 16:36:40 +03:00
committed by ksv741
parent 95fdc8759e
commit 57630102e4
38 changed files with 2914 additions and 155 deletions
+1
View File
@@ -86,6 +86,7 @@ describe("apiClient authentication", () => {
refresh: async () => true,
clear: vi.fn(),
});
// eslint-disable-next-line vitest/valid-expect -- Attach rejection handling before releasing the request; the assertion is awaited below.
const response = expect(
apiClient.GET("/api/v1/brokerage-accounts"),
).rejects.toMatchObject({ name: "AbortError" });
+9 -4
View File
@@ -2,10 +2,15 @@ import createClient from "openapi-fetch";
import createQueryClient from "openapi-react-query";
import type { paths } from "./generated/schema";
import { apiErrorCode } from "./problem-details";
const HTTP_UNAUTHORIZED = 401;
const apiBaseUrl = import.meta.env.VITE_API_BASE_URL ?? "http://localhost:3000";
const configuredBaseUrl: unknown = import.meta.env.VITE_API_BASE_URL;
const apiBaseUrl =
typeof configuredBaseUrl === "string"
? configuredBaseUrl
: "http://localhost:3000";
type AuthHandlers = {
generation?: () => number;
@@ -105,12 +110,12 @@ async function fetchCurrent(
response.status !== HTTP_UNAUTHORIZED ||
isAuthRequest ||
!auth ||
(
apiErrorCode(
await response
.clone()
.json()
.catch(() => null)
)?.code !== "UNAUTHORIZED"
.catch(() => null),
) !== "UNAUTHORIZED"
)
return response;
if (!isCurrent()) throw new DOMException("Session changed", "AbortError");