chore: finish frontend ESLint migration #18

Enable every plugin recommended preset and replace Biome with ESLint formatting.

Preserve API contracts and JSX whitespace; verify source, tests, builds and tooling.
This commit is contained in:
2026-09-28 16:36:40 +03:00
committed by ksv741
parent 57630102e4
commit 72d7835227
253 changed files with 10059 additions and 8864 deletions
@@ -1,11 +1,54 @@
import type { Meta, StoryObj } from "@storybook/react-vite";
import { BankSummaryView } from "./BankSummary.view";
const money = (value: string) => ({ currency: "RUB", value });
const meta = {
title: "Product/BankCards/Summary",
const meta = (/* eslint-disable unicorn/no-null -- Fixture preserves the production contract’s explicit null values. */
{
args: {
data: {
cardId: null,
categories: [
{
categoryId: "food",
categoryName: "Продукты",
expenses: money("3500"),
net: money("2500"),
refunds: money("1000"),
},
{
categoryId: "cafe",
categoryName: "Кафе",
expenses: money("2200"),
net: money("2200"),
refunds: money("0"),
},
{
categoryId: "taxi",
categoryName: "Такси",
expenses: money("1800"),
net: money("1800"),
refunds: money("0"),
},
{
categoryId: "health",
categoryName: "Здоровье",
expenses: money("1000"),
net: money("1000"),
refunds: money("0"),
},
],
expenses: money("8500"),
month: "2026-09",
net: money("7500"),
refunds: money("1000"),
},
error: false,
fetching: false,
loading: false,
retry: () => {},
},
component: BankSummaryView,
tags: ["autodocs"],
parameters: {
docs: {
description: {
@@ -14,118 +57,84 @@ const meta = {
},
},
},
args: {
loading: false,
error: false,
fetching: false,
retry: () => {},
data: {
month: "2026-09",
cardId: null,
expenses: money("8500"),
refunds: money("1000"),
net: money("7500"),
categories: [
{
categoryId: "food",
categoryName: "Продукты",
expenses: money("3500"),
refunds: money("1000"),
net: money("2500"),
},
{
categoryId: "cafe",
categoryName: "Кафе",
expenses: money("2200"),
refunds: money("0"),
net: money("2200"),
},
{
categoryId: "taxi",
categoryName: "Такси",
expenses: money("1800"),
refunds: money("0"),
net: money("1800"),
},
{
categoryId: "health",
categoryName: "Здоровье",
expenses: money("1000"),
refunds: money("0"),
net: money("1000"),
},
],
},
},
} satisfies Meta<typeof BankSummaryView>;
tags: ["autodocs"],
title: "Product/BankCards/Summary",
}
/* eslint-enable unicorn/no-null */) satisfies Meta<typeof BankSummaryView>;
export default meta;
type Story = StoryObj<typeof meta>;
export const Loaded: Story = { name: "Расходы по категориям" };
export const RefundMonth: Story = {
name: "Возврат покупки прошлого месяца",
args: {
data: {
month: "2026-09",
cardId: null,
expenses: money("0"),
refunds: money("600"),
net: money("-600"),
categories: [
{
categoryId: "shopping",
categoryName:
export const RefundMonth: Story = (/* eslint-disable unicorn/no-null -- Fixture preserves the production contract’s explicit null values. */
{
args: {
data: {
cardId: null,
categories: [
{
categoryId: "shopping",
categoryName:
"Покупки с длинным пользовательским названием категории",
expenses: money("0"),
refunds: money("600"),
net: money("-600"),
},
],
expenses: money("0"),
net: money("-600"),
refunds: money("600"),
},
],
expenses: money("0"),
month: "2026-09",
net: money("-600"),
refunds: money("600"),
},
},
},
};
export const Empty: Story = {
name: "Известные нули",
args: {
data: {
month: "2026-09",
cardId: null,
expenses: money("0"),
refunds: money("0"),
net: money("0"),
categories: [],
name: "Возврат покупки прошлого месяца",
}
/* eslint-enable unicorn/no-null */);
export const Empty: Story = (/* eslint-disable unicorn/no-null -- Fixture preserves the production contract’s explicit null values. */
{
args: {
data: {
cardId: null,
categories: [],
expenses: money("0"),
month: "2026-09",
net: money("0"),
refunds: money("0"),
},
},
},
};
name: "Известные нули",
}
/* eslint-enable unicorn/no-null */);
export const Loading: Story = {
name: "Начальная загрузка",
args: { data: undefined, loading: true },
name: "Начальная загрузка",
};
export const Failed: Story = {
name: "Ошибка без данных",
args: { data: undefined, error: true },
name: "Ошибка без данных",
};
export const CachedError: Story = {
name: "Сохранённые суммы при ошибке обновления",
args: { error: true },
name: "Сохранённые суммы при ошибке обновления",
};
export const LongAmounts: Story = {
name: "Точный итог длиннее предела отдельного ввода",
args: {
data: {
month: "2026-09",
cardId: null,
expenses: money("184467440737095516.14"),
refunds: money("0"),
net: money("184467440737095516.14"),
categories: [
{
categoryId: "shopping",
categoryName: "Покупки",
expenses: money("184467440737095516.14"),
refunds: money("0"),
net: money("184467440737095516.14"),
},
],
export const LongAmounts: Story = (/* eslint-disable unicorn/no-null -- Fixture preserves the production contract’s explicit null values. */
{
args: {
data: {
cardId: null,
categories: [
{
categoryId: "shopping",
categoryName: "Покупки",
expenses: money("184467440737095516.14"),
net: money("184467440737095516.14"),
refunds: money("0"),
},
],
expenses: money("184467440737095516.14"),
month: "2026-09",
net: money("184467440737095516.14"),
refunds: money("0"),
},
},
},
};
name: "Точный итог длиннее предела отдельного ввода",
}
/* eslint-enable unicorn/no-null */);
@@ -1,24 +1,78 @@
import type { CSSProperties, FC } from "react";
import { Button, Group, Skeleton, Stack, Text, Title } from "@mantine/core";
import { LoadingSkeleton } from "@wealthledger/ui";
import type { CSSProperties, FC } from "react";
import { useTranslation } from "react-i18next";
import { formatMoney } from "@/shared/lib";
import type { BankSummary } from "../../api/queries";
import { BankOperationIcon } from "../BankOperationIcon/BankOperationIcon";
import classes from "./BankSummary.module.css";
const CATEGORY_COLUMNS = 2;
type BankSummaryViewProps = {
all?: boolean;
data?: BankSummary;
loading: boolean;
error: boolean;
fetching: boolean;
loading: boolean;
retry: () => void;
all?: boolean;
};
const BankSummaryView: FC<BankSummaryViewProps> = (props) => {
const { t } = useTranslation();
function renderCategories() {
if (props.data) {
if (props.data.categories.length > 0) {
return (
<dl
className={classes.categories}
style={
{
"--category-rows": Math.ceil(props.data.categories.length / CATEGORY_COLUMNS),
} as CSSProperties
}
>
{props.data.categories.map(category => (
<div className={classes.category} key={category.categoryId}>
<dt className={classes.label}>
<BankOperationIcon
categoryName={category.categoryName}
kind="expense"
/>
<span>{category.categoryName}</span>
</dt>
<dd className={classes.amount}>
{formatMoney(category.net, { withZeroCents: true })}
</dd>
</div>
))}
</dl>
);
}
return (
<Text c="dimmed" size="sm">
{t("bank.noExpenses")}
</Text>
);
}
if (props.loading) {
return (
<LoadingSkeleton label={t("bank.loading")}>
<Stack gap="sm">
<Skeleton h={32} w="35%" />
<Skeleton h={40} />
<Skeleton h={40} />
</Stack>
</LoadingSkeleton>
);
}
}
return (
<Stack gap="md" aria-busy={props.loading || props.fetching}>
<Stack aria-busy={props.loading || props.fetching} gap="md">
<div className={classes.header}>
<Title order={2}>
{t(props.all ? "bank.allSummary" : "bank.summary")}
@@ -29,49 +83,11 @@ const BankSummaryView: FC<BankSummaryViewProps> = (props) => {
</Text>
)}
</div>
{props.data ? (
props.data.categories.length ? (
<dl
className={classes.categories}
style={
{
"--category-rows": Math.ceil(props.data.categories.length / 2),
} as CSSProperties
}
>
{props.data.categories.map((category) => (
<div className={classes.category} key={category.categoryId}>
<dt className={classes.label}>
<BankOperationIcon
kind="expense"
categoryName={category.categoryName}
/>
<span>{category.categoryName}</span>
</dt>
<dd className={classes.amount}>
{formatMoney(category.net, { withZeroCents: true })}
</dd>
</div>
))}
</dl>
) : (
<Text size="sm" c="dimmed">
{t("bank.noExpenses")}
</Text>
)
) : props.loading ? (
<LoadingSkeleton label={t("bank.loading")}>
<Stack gap="sm">
<Skeleton h={32} w="35%" />
<Skeleton h={40} />
<Skeleton h={40} />
</Stack>
</LoadingSkeleton>
) : null}
{renderCategories()}
{props.error && (
<Group role="alert">
<Text>{t(props.data ? "bank.refreshError" : "bank.error")}</Text>
<Button variant="default" onClick={props.retry}>
<Button onClick={props.retry} variant="default">
{t("bank.retry")}
</Button>
</Group>