From 5b13b74a7ae26c63a76611a5801d4695ec86c04c Mon Sep 17 00:00:00 2001 From: Andrey Epifancev Date: Mon, 19 Oct 2026 11:27:10 +0400 Subject: [PATCH] =?UTF-8?q?=D0=A4=D0=BE=D1=80=D0=BC=D0=B0=D1=82=D0=B8?= =?UTF-8?q?=D1=80=D0=BE=D0=B2=D0=B0=D0=BD=D0=B8=D0=B5=20=D0=BF=D0=BE=D0=B4?= =?UTF-8?q?=20ESLint=20+=20Prettier,=20=D0=B7=D0=B5=D0=BB=D1=91=D0=BD?= =?UTF-8?q?=D1=8B=D0=B9=20make=20check=20(#31)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit npm run format: порядок импортов (biome) в CompanyGroupsList.tsx, Prettier в пяти файлах; правки только оформления. make check: eslint 0 ошибок (19 предупреждений), vitest 324/324, build ок. Co-Authored-By: Claude Opus 5.5 --- src/components/TableTag/presets.tsx | 6 +- src/hooks/useVirtualList.tsx | 71 +++++++++---------- src/services/api/directories/catalogue_jur.ts | 2 +- .../CatalogueJurForm/CatalogueJurForm.tsx | 2 +- .../CatalogueJurTable/CatalogueJurTable.tsx | 2 +- .../CompanyGroupsList/CompanyGroupsList.tsx | 10 +-- 6 files changed, 44 insertions(+), 49 deletions(-) diff --git a/src/components/TableTag/presets.tsx b/src/components/TableTag/presets.tsx index 3647e0f..1846879 100644 --- a/src/components/TableTag/presets.tsx +++ b/src/components/TableTag/presets.tsx @@ -40,8 +40,8 @@ export const TAG_PRESETS = { color: 'rgb(146, 64, 14)', }, gray: { - color: 'rgb(71, 84, 103)', - bgColor: 'rgb(248, 250, 252)', - borderColor: 'rgba(15, 23, 42, 0.08)', + color: 'rgb(71, 84, 103)', + bgColor: 'rgb(248, 250, 252)', + borderColor: 'rgba(15, 23, 42, 0.08)', }, } as const; diff --git a/src/hooks/useVirtualList.tsx b/src/hooks/useVirtualList.tsx index fdd04b9..d019b08 100644 --- a/src/hooks/useVirtualList.tsx +++ b/src/hooks/useVirtualList.tsx @@ -1,51 +1,46 @@ -import { useCallback, useMemo, useRef, useState } from "react"; +import { useCallback, useMemo, useRef, useState } from 'react'; type Options = { - /** высота одного элемента в px (фиксированная) */ - itemHeight: number; - /** высота контейнера в px (видимая область) */ - containerHeight: number; - /** сколько элементов рендерить дополнительно сверху/снизу */ - overscan?: number; + /** высота одного элемента в px (фиксированная) */ + itemHeight: number; + /** высота контейнера в px (видимая область) */ + containerHeight: number; + /** сколько элементов рендерить дополнительно сверху/снизу */ + overscan?: number; }; export function useVirtualList(items: T[], options: Options) { - const { itemHeight, containerHeight, overscan = 5 } = options; + const { itemHeight, containerHeight, overscan = 5 } = options; - const [scrollTop, setScrollTop] = useState(0); - const ref = useRef(null); + const [scrollTop, setScrollTop] = useState(0); + const ref = useRef(null); - const totalHeight = items.length * itemHeight; + const totalHeight = items.length * itemHeight; - const startIndex = Math.max( - 0, - Math.floor(scrollTop / itemHeight) - overscan, - ); + const startIndex = Math.max(0, Math.floor(scrollTop / itemHeight) - overscan); - const endIndex = Math.min( - items.length, - Math.ceil((scrollTop + containerHeight) / itemHeight) + overscan, - ); + const endIndex = Math.min(items.length, Math.ceil((scrollTop + containerHeight) / itemHeight) + overscan); - const visibleItems = useMemo( - () => items.slice(startIndex, endIndex).map((item, i) => ({ - item, - index: startIndex + i, - })), - [items, startIndex, endIndex], - ); + const visibleItems = useMemo( + () => + items.slice(startIndex, endIndex).map((item, i) => ({ + item, + index: startIndex + i, + })), + [items, startIndex, endIndex], + ); - const offsetY = startIndex * itemHeight; + const offsetY = startIndex * itemHeight; - const onScroll = useCallback((e: React.UIEvent) => { - setScrollTop(e.currentTarget.scrollTop); - }, []); + const onScroll = useCallback((e: React.UIEvent) => { + setScrollTop(e.currentTarget.scrollTop); + }, []); - return { - ref, - onScroll, - visibleItems, - totalHeight, - offsetY, - }; -} \ No newline at end of file + return { + ref, + onScroll, + visibleItems, + totalHeight, + offsetY, + }; +} diff --git a/src/services/api/directories/catalogue_jur.ts b/src/services/api/directories/catalogue_jur.ts index c84de06..9b1d30a 100644 --- a/src/services/api/directories/catalogue_jur.ts +++ b/src/services/api/directories/catalogue_jur.ts @@ -10,7 +10,7 @@ import type { import { LE_PAGE } from './company_groups'; export async function fetchCatalogueJur(params: GetCatalogueJurPropsI) { - const res = await api.get>('/directories/legal-entities', {limit:LE_PAGE, offset:0, ...params}); + const res = await api.get>('/directories/legal-entities', { limit: LE_PAGE, offset: 0, ...params }); return res; } diff --git a/src/widgets/CatalogueJurForm/CatalogueJurForm.tsx b/src/widgets/CatalogueJurForm/CatalogueJurForm.tsx index ccf1364..bd865e0 100644 --- a/src/widgets/CatalogueJurForm/CatalogueJurForm.tsx +++ b/src/widgets/CatalogueJurForm/CatalogueJurForm.tsx @@ -54,7 +54,7 @@ export const CatalogueJurForm: React.FC = ({ open, onCancel, onOk, jurId } catch (e) { if (e instanceof ApiError) { notification.error({ description: e.message }); - } + } } finally { setInitialDataLoading(false); } diff --git a/src/widgets/CatalogueJurTable/CatalogueJurTable.tsx b/src/widgets/CatalogueJurTable/CatalogueJurTable.tsx index edb5b12..9311884 100644 --- a/src/widgets/CatalogueJurTable/CatalogueJurTable.tsx +++ b/src/widgets/CatalogueJurTable/CatalogueJurTable.tsx @@ -243,7 +243,7 @@ export function CatalogueJurTable({ outside_group, tabsComponent }: CatalogueJur - {(relatedGroupFilter?.id && !outside_group) && ( + {relatedGroupFilter?.id && !outside_group && (