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:
+82
-75
@@ -1,34 +1,36 @@
|
||||
import type { Meta, StoryObj } from "@storybook/react-vite";
|
||||
|
||||
import { MemoryRouter } from "react-router";
|
||||
|
||||
import type { BrokerageAccount } from "../../api/useBrokerageAccounts";
|
||||
|
||||
import { brokerageAccountCards } from "../../model/display";
|
||||
import { BrokerageAccountList } from "./BrokerageAccountList";
|
||||
|
||||
const syntheticAccount = {
|
||||
id: "storybook-account",
|
||||
name: "Учебный брокерский счёт",
|
||||
type: "BROKERAGE",
|
||||
openedOn: "2025-03-15",
|
||||
portfolioSummary: {
|
||||
stockPositionCount: 5,
|
||||
bondPositionCount: 12,
|
||||
stockPositionCount: 5,
|
||||
totalsByCurrency: [
|
||||
{ currency: "RUB", value: "125000.50" },
|
||||
{ currency: "USD", value: "320" },
|
||||
{ currency: "EUR", value: "210" },
|
||||
],
|
||||
},
|
||||
type: "BROKERAGE",
|
||||
} satisfies BrokerageAccount;
|
||||
|
||||
const meta = {
|
||||
title: "Product/BrokerageAccountList",
|
||||
component: BrokerageAccountList,
|
||||
tags: ["autodocs"],
|
||||
args: { accounts: brokerageAccountCards([syntheticAccount]) },
|
||||
argTypes: {
|
||||
accounts: { control: false },
|
||||
},
|
||||
component: BrokerageAccountList,
|
||||
decorators: [
|
||||
(Story) => (
|
||||
Story => (
|
||||
<MemoryRouter initialEntries={["/accounts"]}>
|
||||
<Story />
|
||||
</MemoryRouter>
|
||||
@@ -42,7 +44,8 @@ const meta = {
|
||||
},
|
||||
},
|
||||
},
|
||||
args: { accounts: brokerageAccountCards([syntheticAccount]) },
|
||||
tags: ["autodocs"],
|
||||
title: "Product/BrokerageAccountList",
|
||||
} satisfies Meta<typeof BrokerageAccountList>;
|
||||
|
||||
export default meta;
|
||||
@@ -61,37 +64,39 @@ export const Available: Story = {
|
||||
},
|
||||
};
|
||||
|
||||
export const Unavailable: Story = {
|
||||
name: "Сводка недоступна",
|
||||
args: {
|
||||
accounts: brokerageAccountCards([
|
||||
{ ...syntheticAccount, portfolioSummary: null, openedOn: null },
|
||||
]),
|
||||
},
|
||||
parameters: {
|
||||
docs: {
|
||||
description: {
|
||||
story:
|
||||
export const Unavailable: Story = (/* eslint-disable unicorn/no-null -- Fixture preserves the production contract’s explicit null values. */
|
||||
{
|
||||
args: {
|
||||
accounts: brokerageAccountCards([
|
||||
{ ...syntheticAccount, openedOn: null, portfolioSummary: null },
|
||||
]),
|
||||
},
|
||||
name: "Сводка недоступна",
|
||||
parameters: {
|
||||
docs: {
|
||||
description: {
|
||||
story:
|
||||
"Счёт остаётся доступен для открытия, даже если сводка временно недоступна. Неизвестные суммы не заменяются нулём; отсутствующая дата открытия не отображается.",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
}
|
||||
/* eslint-enable unicorn/no-null */);
|
||||
|
||||
export const Empty: Story = {
|
||||
name: "Нет текущих сумм",
|
||||
args: {
|
||||
accounts: brokerageAccountCards([
|
||||
{
|
||||
...syntheticAccount,
|
||||
portfolioSummary: {
|
||||
totalsByCurrency: [],
|
||||
stockPositionCount: 0,
|
||||
bondPositionCount: 0,
|
||||
stockPositionCount: 0,
|
||||
totalsByCurrency: [],
|
||||
},
|
||||
},
|
||||
]),
|
||||
},
|
||||
name: "Нет текущих сумм",
|
||||
parameters: {
|
||||
docs: {
|
||||
description: {
|
||||
@@ -103,7 +108,6 @@ export const Empty: Story = {
|
||||
};
|
||||
|
||||
export const LongName: Story = {
|
||||
name: "Длинное название счёта",
|
||||
args: {
|
||||
accounts: brokerageAccountCards([
|
||||
{
|
||||
@@ -113,6 +117,7 @@ export const LongName: Story = {
|
||||
},
|
||||
]),
|
||||
},
|
||||
name: "Длинное название счёта",
|
||||
parameters: {
|
||||
docs: {
|
||||
description: {
|
||||
@@ -124,105 +129,107 @@ export const LongName: Story = {
|
||||
};
|
||||
|
||||
export const AccountGrid: Story = {
|
||||
name: "Несколько счетов",
|
||||
args: {
|
||||
accounts: brokerageAccountCards([
|
||||
{
|
||||
...syntheticAccount,
|
||||
name: "Основной",
|
||||
portfolioSummary: {
|
||||
totalsByCurrency: [{ currency: "RUB", value: "1256430.50" }],
|
||||
stockPositionCount: 8,
|
||||
bondPositionCount: 14,
|
||||
stockPositionCount: 8,
|
||||
totalsByCurrency: [{ currency: "RUB", value: "1256430.50" }],
|
||||
},
|
||||
},
|
||||
{
|
||||
...syntheticAccount,
|
||||
id: "storybook-iis",
|
||||
name: "Долгосрочные инвестиции",
|
||||
type: "INDIVIDUAL_INVESTMENT",
|
||||
portfolioSummary: {
|
||||
totalsByCurrency: [{ currency: "RUB", value: "480250" }],
|
||||
stockPositionCount: 0,
|
||||
bondPositionCount: 6,
|
||||
stockPositionCount: 0,
|
||||
totalsByCurrency: [{ currency: "RUB", value: "480250" }],
|
||||
},
|
||||
type: "INDIVIDUAL_INVESTMENT",
|
||||
},
|
||||
]),
|
||||
},
|
||||
name: "Несколько счетов",
|
||||
};
|
||||
|
||||
export const UnvaluedPositions: Story = {
|
||||
name: "Бумаги без текущей оценки",
|
||||
args: {
|
||||
accounts: brokerageAccountCards([
|
||||
{
|
||||
...syntheticAccount,
|
||||
portfolioSummary: {
|
||||
totalsByCurrency: [],
|
||||
stockPositionCount: 2,
|
||||
bondPositionCount: 1,
|
||||
stockPositionCount: 2,
|
||||
totalsByCurrency: [],
|
||||
},
|
||||
},
|
||||
]),
|
||||
},
|
||||
name: "Бумаги без текущей оценки",
|
||||
};
|
||||
|
||||
export const LargeValues: Story = {
|
||||
name: "Длинные суммы",
|
||||
args: {
|
||||
accounts: brokerageAccountCards([
|
||||
{
|
||||
...syntheticAccount,
|
||||
portfolioSummary: {
|
||||
bondPositionCount: 105,
|
||||
stockPositionCount: 21,
|
||||
totalsByCurrency: [
|
||||
{ currency: "RUB", value: "1234567890123456789.50" },
|
||||
{ currency: "USD", value: "-9876543210987654321.50" },
|
||||
],
|
||||
stockPositionCount: 21,
|
||||
bondPositionCount: 105,
|
||||
},
|
||||
},
|
||||
]),
|
||||
},
|
||||
name: "Длинные суммы",
|
||||
};
|
||||
|
||||
export const IndependentFreshness: Story = {
|
||||
name: "Независимая свежесть и ошибка сводок",
|
||||
args: {
|
||||
accounts: brokerageAccountCards(
|
||||
[
|
||||
syntheticAccount,
|
||||
{
|
||||
...syntheticAccount,
|
||||
id: "waiting",
|
||||
name: "Новый счёт",
|
||||
portfolioSummary: null,
|
||||
},
|
||||
],
|
||||
[
|
||||
{
|
||||
resourceKey: "portfolio/storybook-account",
|
||||
dataRevision: "1",
|
||||
stateVersion: "failed",
|
||||
availability: "complete",
|
||||
freshness: "stale",
|
||||
lastSuccessfulAt: "2026-09-24T10:30:00Z",
|
||||
sync: {
|
||||
id: "failed",
|
||||
state: "failed",
|
||||
errorCode: "TBANK_UNAVAILABLE",
|
||||
export const IndependentFreshness: Story = (/* eslint-disable unicorn/no-null -- Fixture preserves the production contract’s explicit null values. */
|
||||
{
|
||||
args: {
|
||||
accounts: brokerageAccountCards(
|
||||
[
|
||||
syntheticAccount,
|
||||
{
|
||||
...syntheticAccount,
|
||||
id: "waiting",
|
||||
name: "Новый счёт",
|
||||
portfolioSummary: null,
|
||||
},
|
||||
},
|
||||
{
|
||||
resourceKey: "portfolio/waiting",
|
||||
dataRevision: "0",
|
||||
stateVersion: "waiting",
|
||||
availability: "missing",
|
||||
freshness: "unknown",
|
||||
lastSuccessfulAt: null,
|
||||
sync: { id: "waiting", state: "running", errorCode: null },
|
||||
},
|
||||
],
|
||||
),
|
||||
},
|
||||
};
|
||||
],
|
||||
[
|
||||
{
|
||||
availability: "complete",
|
||||
dataRevision: "1",
|
||||
freshness: "stale",
|
||||
lastSuccessfulAt: "2026-09-24T10:30:00Z",
|
||||
resourceKey: "portfolio/storybook-account",
|
||||
stateVersion: "failed",
|
||||
sync: {
|
||||
errorCode: "TBANK_UNAVAILABLE",
|
||||
id: "failed",
|
||||
state: "failed",
|
||||
},
|
||||
},
|
||||
{
|
||||
availability: "missing",
|
||||
dataRevision: "0",
|
||||
freshness: "unknown",
|
||||
lastSuccessfulAt: null,
|
||||
resourceKey: "portfolio/waiting",
|
||||
stateVersion: "waiting",
|
||||
sync: { errorCode: null, id: "waiting", state: "running" },
|
||||
},
|
||||
],
|
||||
),
|
||||
},
|
||||
name: "Независимая свежесть и ошибка сводок",
|
||||
}
|
||||
/* eslint-enable unicorn/no-null */);
|
||||
|
||||
Reference in New Issue
Block a user