From 14c767a6753c9b91fc2bf0b6c177ff69e5f1e55b Mon Sep 17 00:00:00 2001 From: Maurice Date: Wed, 4 Nov 2026 19:07:39 +0100 Subject: [PATCH] fix(client): keep the open-at rule on the client's library target, and settle CI Array.prototype.at is past the client's lib target, so the journey open-at rule indexes the array. The packing row test expects the title that names every bringer, a carousel test acts without a floating promise, and the lint baseline drops to the counts this branch reaches. --- client/scripts/eslint-baseline.json | 4 ++-- client/src/components/Journey/journeyOpenAt.ts | 7 ++++--- .../src/components/Journey/useJourneyCarouselSync.test.ts | 4 +++- .../components/Packing/PackingListPanelItemRow.test.tsx | 4 ++-- 4 files changed, 11 insertions(+), 8 deletions(-) diff --git a/client/scripts/eslint-baseline.json b/client/scripts/eslint-baseline.json index 9902dada8..b572afd98 100644 --- a/client/scripts/eslint-baseline.json +++ b/client/scripts/eslint-baseline.json @@ -1,6 +1,6 @@ { "src": { - "@typescript-eslint/no-non-null-assertion": 380, + "@typescript-eslint/no-non-null-assertion": 377, "@typescript-eslint/no-misused-promises": 847, "no-console": 88, "complexity": 218, @@ -8,7 +8,7 @@ "trek/no-swallowed-catch": 128, "max-params": 32, "trek/store-without-selector": 67, - "react-hooks/refs": 555, + "react-hooks/refs": 554, "react-hooks/set-state-in-effect": 193, "@typescript-eslint/no-floating-promises": 164, "react-hooks/exhaustive-deps": 116, diff --git a/client/src/components/Journey/journeyOpenAt.ts b/client/src/components/Journey/journeyOpenAt.ts index 1eb5dfeca..7c9eb473f 100644 --- a/client/src/components/Journey/journeyOpenAt.ts +++ b/client/src/components/Journey/journeyOpenAt.ts @@ -26,13 +26,14 @@ export function journeyOpenAtEntryId( { today, newestFirst = false }: { today: string; newestFirst?: boolean } ): string | null { const dated = [...entries].sort((a, b) => a.entry_date.localeCompare(b.entry_date)); - const first = dated.at(0); - const last = dated.at(-1); + const first = dated[0]; + const last = dated[dated.length - 1]; if (!first || !last) return null; let day = last.entry_date; if (!newestFirst) { if (today < first.entry_date || today > last.entry_date) return null; - day = dated.filter((e) => e.entry_date <= today).at(-1)?.entry_date ?? first.entry_date; + const reached = dated.filter((e) => e.entry_date <= today); + day = reached[reached.length - 1]?.entry_date ?? first.entry_date; } const dayStart = dated.find((e) => e.entry_date === day) ?? first; return String(dayStart.id); diff --git a/client/src/components/Journey/useJourneyCarouselSync.test.ts b/client/src/components/Journey/useJourneyCarouselSync.test.ts index 0b19415b8..c8d5bb9e2 100644 --- a/client/src/components/Journey/useJourneyCarouselSync.test.ts +++ b/client/src/components/Journey/useJourneyCarouselSync.test.ts @@ -169,7 +169,9 @@ describe('useJourneyCarouselSync', () => { const settleAt = (scrollLeft: number) => { Object.defineProperty(carousel, 'scrollLeft', { value: scrollLeft, configurable: true }); carousel.dispatchEvent(new Event('scroll')); - act(() => vi.advanceTimersByTime(150)); + act(() => { + vi.advanceTimersByTime(150); + }); }; settleAt(300); diff --git a/client/src/components/Packing/PackingListPanelItemRow.test.tsx b/client/src/components/Packing/PackingListPanelItemRow.test.tsx index 43d72f287..1603443ee 100644 --- a/client/src/components/Packing/PackingListPanelItemRow.test.tsx +++ b/client/src/components/Packing/PackingListPanelItemRow.test.tsx @@ -419,8 +419,8 @@ describe('ArtikelZeile — sharing badges', () => { currentUserId: 1, }) - // The bringer's initial on an avatar, the co-bringers as a count. - expect(screen.getByTitle('brought by Bob')).toHaveTextContent('B+1') + // The bringer's initial on an avatar, the co-bringers as a count; the title names everyone (#2782). + expect(screen.getByTitle('brought by Bob, cleo')).toHaveTextContent('B+1') }) it('FE-W5ROW-022: a bringer without co-bringers shows no counter', () => {