From f3a10e38dfacfb580756ce582323180d6322aba0 Mon Sep 17 00:00:00 2001 From: Ilia Mashkov Date: Tue, 2 Jun 2026 23:01:59 +0300 Subject: [PATCH] refactor: clear remaining lint errors (comma operator, bind:this ref) - splitArray: replace the comma-operator reduce body with an explicit block + return (no-sequences); behaviour unchanged - BreadcrumbHeaderSeeded: declare the bind:this ref with $state() so it is not flagged as never-assigned (oxlint cannot see template bindings), matching the rest of the codebase; guard the onMount use --- .../ui/BreadcrumbHeader/BreadcrumbHeaderSeeded.svelte | 8 ++++++-- src/shared/lib/utils/splitArray/splitArray.ts | 11 ++++++++--- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/src/features/Breadcrumb/ui/BreadcrumbHeader/BreadcrumbHeaderSeeded.svelte b/src/features/Breadcrumb/ui/BreadcrumbHeader/BreadcrumbHeaderSeeded.svelte index af9cc17..0052c57 100644 --- a/src/features/Breadcrumb/ui/BreadcrumbHeader/BreadcrumbHeaderSeeded.svelte +++ b/src/features/Breadcrumb/ui/BreadcrumbHeader/BreadcrumbHeaderSeeded.svelte @@ -11,10 +11,14 @@ const sections = [ { index: 102, title: 'Spacing' }, ]; -/** @type {HTMLDivElement} */ -let container; +/** @type {HTMLDivElement | undefined} */ +let container = $state(); onMount(() => { + if (!container) { + return; + } + for (const section of sections) { const el = /** @type {HTMLElement} */ (container.querySelector(`[data-story-index="${section.index}"]`)); scrollBreadcrumbsStore.add({ index: section.index, title: section.title, element: el }, 96); diff --git a/src/shared/lib/utils/splitArray/splitArray.ts b/src/shared/lib/utils/splitArray/splitArray.ts index a3ea60c..bf03a24 100644 --- a/src/shared/lib/utils/splitArray/splitArray.ts +++ b/src/shared/lib/utils/splitArray/splitArray.ts @@ -24,9 +24,14 @@ */ export function splitArray(array: T[], callback: (item: T) => boolean) { return array.reduce<[T[], T[]]>( - ([pass, fail], item) => ( - callback(item) ? pass.push(item) : fail.push(item), [pass, fail] - ), + ([pass, fail], item) => { + if (callback(item)) { + pass.push(item); + } else { + fail.push(item); + } + return [pass, fail]; + }, [[], []], ); }