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:
+73
-64
@@ -1,32 +1,53 @@
|
||||
import type { Meta, StoryObj } from "@storybook/react-vite";
|
||||
|
||||
import { MemoryRouter } from "react-router";
|
||||
|
||||
import type { BrokerageEvent } from "../../api/useBrokerageEvents";
|
||||
|
||||
import { BrokerageEventsPreview } from "./BrokerageEventsPreview";
|
||||
|
||||
const syntheticEvent = {
|
||||
type: "coupon",
|
||||
const syntheticEvent = (/* eslint-disable unicorn/no-null -- Fixture preserves the production contract’s explicit null values. */
|
||||
{
|
||||
date: "2026-10-15",
|
||||
dateKind: "event",
|
||||
displayName: "Учебные облигации",
|
||||
figi: null,
|
||||
instrumentUid: null,
|
||||
ticker: "DEMO",
|
||||
displayName: "Учебные облигации",
|
||||
logoName: null,
|
||||
isin: "RU000A0JX0J2",
|
||||
logoName: null,
|
||||
projectedAmount: { currency: "RUB", value: "850.50" },
|
||||
} satisfies BrokerageEvent;
|
||||
ticker: "DEMO",
|
||||
type: "coupon",
|
||||
}
|
||||
/* eslint-enable unicorn/no-null */) satisfies BrokerageEvent;
|
||||
|
||||
const eventsPath = "/accounts/storybook-account/events";
|
||||
|
||||
const meta = {
|
||||
title: "Product/RecentEvents",
|
||||
component: BrokerageEventsPreview,
|
||||
tags: ["autodocs"],
|
||||
args: {
|
||||
events: {
|
||||
items: [
|
||||
syntheticEvent,
|
||||
{
|
||||
...syntheticEvent,
|
||||
date: "2026-11-01",
|
||||
dateKind: "registry",
|
||||
displayName: "Учебные технологии",
|
||||
projectedAmount: { currency: "RUB", value: "1200" },
|
||||
ticker: "EXAMPLE",
|
||||
type: "dividend",
|
||||
},
|
||||
],
|
||||
state: "loaded",
|
||||
to: eventsPath,
|
||||
},
|
||||
},
|
||||
argTypes: {
|
||||
events: { control: false },
|
||||
},
|
||||
component: BrokerageEventsPreview,
|
||||
decorators: [
|
||||
(Story) => (
|
||||
Story => (
|
||||
<MemoryRouter initialEntries={["/accounts/storybook-account"]}>
|
||||
<Story />
|
||||
</MemoryRouter>
|
||||
@@ -40,24 +61,8 @@ const meta = {
|
||||
},
|
||||
},
|
||||
},
|
||||
args: {
|
||||
events: {
|
||||
state: "loaded",
|
||||
to: eventsPath,
|
||||
items: [
|
||||
syntheticEvent,
|
||||
{
|
||||
...syntheticEvent,
|
||||
type: "dividend",
|
||||
date: "2026-11-01",
|
||||
dateKind: "registry",
|
||||
ticker: "EXAMPLE",
|
||||
displayName: "Учебные технологии",
|
||||
projectedAmount: { currency: "RUB", value: "1200" },
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
tags: ["autodocs"],
|
||||
title: "Product/RecentEvents",
|
||||
} satisfies Meta<typeof BrokerageEventsPreview>;
|
||||
|
||||
export default meta;
|
||||
@@ -77,8 +82,8 @@ export const Loaded: Story = {
|
||||
};
|
||||
|
||||
export const Loading: Story = {
|
||||
name: "Загрузка раздела",
|
||||
args: { events: { state: "loading", to: eventsPath } },
|
||||
name: "Загрузка раздела",
|
||||
parameters: {
|
||||
docs: {
|
||||
description: {
|
||||
@@ -90,8 +95,8 @@ export const Loading: Story = {
|
||||
};
|
||||
|
||||
export const Failed: Story = {
|
||||
name: "Ошибка получения событий",
|
||||
args: { events: { state: "error", to: eventsPath } },
|
||||
name: "Ошибка получения событий",
|
||||
parameters: {
|
||||
docs: {
|
||||
description: {
|
||||
@@ -103,8 +108,8 @@ export const Failed: Story = {
|
||||
};
|
||||
|
||||
export const Empty: Story = {
|
||||
name: "Нет ближайших событий",
|
||||
args: { events: { state: "empty", to: eventsPath } },
|
||||
name: "Нет ближайших событий",
|
||||
parameters: {
|
||||
docs: {
|
||||
description: {
|
||||
@@ -115,40 +120,44 @@ export const Empty: Story = {
|
||||
},
|
||||
};
|
||||
|
||||
export const MissingAmount: Story = {
|
||||
name: "Событие без ожидаемой суммы",
|
||||
args: {
|
||||
events: {
|
||||
state: "loaded",
|
||||
to: eventsPath,
|
||||
items: [{ ...syntheticEvent, projectedAmount: null }],
|
||||
},
|
||||
},
|
||||
parameters: {
|
||||
docs: {
|
||||
description: {
|
||||
story:
|
||||
"Событие остаётся видимым при неизвестной ожидаемой сумме. Отсутствие оценки не подменяется нулевой выплатой.",
|
||||
export const MissingAmount: Story = (/* eslint-disable unicorn/no-null -- Fixture preserves the production contract’s explicit null values. */
|
||||
{
|
||||
args: {
|
||||
events: {
|
||||
items: [{ ...syntheticEvent, projectedAmount: null }],
|
||||
state: "loaded",
|
||||
to: eventsPath,
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
export const LongEvent: Story = {
|
||||
name: "Длинное название на узком экране",
|
||||
args: {
|
||||
events: {
|
||||
state: "loaded",
|
||||
to: eventsPath,
|
||||
items: [
|
||||
{
|
||||
...syntheticEvent,
|
||||
type: "offer",
|
||||
displayName:
|
||||
"Учебные облигации компании с очень длинным названием инструмента",
|
||||
projectedAmount: null,
|
||||
name: "Событие без ожидаемой суммы",
|
||||
parameters: {
|
||||
docs: {
|
||||
description: {
|
||||
story:
|
||||
"Событие остаётся видимым при неизвестной ожидаемой сумме. Отсутствие оценки не подменяется нулевой выплатой.",
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
}
|
||||
/* eslint-enable unicorn/no-null */);
|
||||
|
||||
export const LongEvent: Story = (/* eslint-disable unicorn/no-null -- Fixture preserves the production contract’s explicit null values. */
|
||||
{
|
||||
args: {
|
||||
events: {
|
||||
items: [
|
||||
{
|
||||
...syntheticEvent,
|
||||
displayName:
|
||||
"Учебные облигации компании с очень длинным названием инструмента",
|
||||
projectedAmount: null,
|
||||
type: "offer",
|
||||
},
|
||||
],
|
||||
state: "loaded",
|
||||
to: eventsPath,
|
||||
},
|
||||
},
|
||||
name: "Длинное название на узком экране",
|
||||
}
|
||||
/* eslint-enable unicorn/no-null */);
|
||||
|
||||
Reference in New Issue
Block a user