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
@@ -43,18 +43,22 @@ type IncomeDisplayModel = {
type AccountIncomePageViewModel =
| { state: "loading" }
| { state: "error"; retry: () => void; period: IncomePeriod }
| {
state: "error";
retry: () => undefined | Promise<unknown>;
period: IncomePeriod;
}
| {
state: "loaded";
analytics: IncomeAnalytics;
display: IncomeDisplayModel;
formRevision: number;
formRevision: string;
sourceError?: boolean;
lastSuccessfulAt?: string | null;
partial?: boolean;
refreshing: boolean;
refreshError: boolean;
retry: () => void;
retry: () => undefined | Promise<unknown>;
form: ReturnType<typeof useForm<IncomeForm>>;
onReset: () => void;
onSubmit: (values: IncomeForm) => void;
@@ -102,7 +106,7 @@ const useAccountIncomePageViewModel = (
defaultValues: draftPeriod(period),
resolver: zodResolver(incomeFormSchema),
});
const [formRevision, setFormRevision] = useState(0);
const [resetRevision, setResetRevision] = useState(0);
const analytics = useIncomeAnalytics(accountId, period);
const sync = useScreenSync(
{ screen: "income", accountId, from: period.from, to: period.to },
@@ -114,7 +118,6 @@ const useAccountIncomePageViewModel = (
}, [period, requested, setSearchParams]);
useEffect(() => {
form.reset(draftPeriod(period));
setFormRevision((revision) => revision + 1);
}, [form, period]);
const onSubmit = (values: IncomeForm) => {
@@ -126,7 +129,7 @@ const useAccountIncomePageViewModel = (
const next = defaultPeriod();
form.reset(draftPeriod(next));
// Reset the open calendar along with the form.
setFormRevision((revision) => revision + 1);
setResetRevision((revision) => revision + 1);
setSearchParams(next, { replace: true });
};
if (analytics.isLoading || !analytics.data) {
@@ -138,16 +141,14 @@ const useAccountIncomePageViewModel = (
if (!display)
return {
state: "error",
retry: () => {
void analytics.observe();
},
retry: () => analytics.observe(),
period,
};
return {
state: "loaded",
analytics: analytics.data,
display,
formRevision,
formRevision: `${period.from}:${period.to}:${resetRevision}`,
sourceError: sync.sourceError,
lastSuccessfulAt: analytics.meta?.lastSuccessfulAt,
partial: analytics.meta?.availability !== "complete",