From 559cfbee3e80295e5fc71fb0b7ded9f724a9ac1a Mon Sep 17 00:00:00 2001 From: senke Date: Thu, 30 Apr 2026 23:30:22 +0200 Subject: [PATCH] refactor(web): zero out 3 ESLint warning buckets (storybook + react-refresh + non-null-assertion) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Three rules cleaned in parallel passes — 187 fewer warnings, 0 TS errors, 0 behaviour change beyond one incidental auth bugfix flagged below. storybook/no-redundant-story-name (23 → 0) — 14 stories files Storybook v7+ infers the story name from the variable name, so `name: 'Default'` next to `export const Default: Story = …` is pure noise. Removed only when the name was redundant ; preserved when the label was a French translation ('Par défaut', 'Chargement', 'Avec erreur', etc.) since those are intentional. react-refresh/only-export-components (25 → 0) — 21 files Each warning marks a file that exports a React component AND a hook / context / constant / barrel re-export. Suppressed per-line with the suppression-with-justification pattern : // eslint-disable-next-line react-refresh/only-export-components -- ; refactor would split a tightly-coupled API The justification matters — every comment names the specific thing being co-located (hook / context / CVA constant / lazy registry / route config / test util / backward-compat barrel). Splitting these would create 21 new files for a HMR-only DX win that's already a non-issue in practice. @typescript-eslint/no-non-null-assertion (139 → 0) — 43 files Distribution of fixes : ~85 cases : refactored to explicit guard `if (!x) throw new Error('invariant: …')` or hoisted into local with narrowing. ~36 cases : helper extraction (one tooltip test had 16 `wrapper!` patterns reduced to a single `getWrapper()` helper). ~18 cases : suppressed with specific reason : static literal arrays where index is provably in bounds, mock fixtures with structural guarantees, filter-then-map patterns where the filter excludes the null branch. One incidental find : services/api/auth.ts threw on missing tokens but didn't guard `user` ; added the missing check while refactoring the `user!` to a guard. baseline post-commit : 921 warnings, 0 errors, 0 TS errors. The remaining buckets are no-restricted-syntax (757, design-system guardrail), no-explicit-any (115), exhaustive-deps (49). CI --max-warnings will be lowered to 921 in the follow-up commit. Co-Authored-By: Claude Opus 4.7 (1M context) --- .github/workflows/ci.yml | 21 +++--- .../developer/APIPlaygroundView.tsx | 1 + .../src/components/feedback/ToastProvider.tsx | 2 + .../library/playlists/QueueView.stories.tsx | 1 - .../marketplace/LicenceCard.stories.tsx | 3 - .../marketplace/ProductDetailView.stories.tsx | 1 - .../src/components/navigation/Breadcrumbs.tsx | 1 + .../web/src/components/player/AudioPlayer.tsx | 1 + .../web/src/components/player/LyricsPanel.tsx | 14 ++-- .../seller/CreateProductView.stories.tsx | 1 - .../account/AccountSettings.stories.tsx | 1 - .../src/components/theme/ThemeProvider.tsx | 1 + apps/web/src/components/ui/LazyComponent.tsx | 1 + .../components/ui/WaveformVisualizer.test.tsx | 6 +- apps/web/src/components/ui/button.tsx | 1 + apps/web/src/components/ui/card.tsx | 1 + apps/web/src/components/ui/dropdown.test.tsx | 6 +- .../src/components/ui/file-upload.test.tsx | 5 +- .../web/src/components/ui/optimized-image.tsx | 1 + .../src/components/ui/radio-group.test.tsx | 3 +- .../ui/select/SelectDropdownContent.tsx | 3 +- .../web/src/components/ui/select/useSelect.ts | 5 +- apps/web/src/components/ui/tooltip.test.tsx | 67 ++++++++++--------- .../src/components/ui/virtualized-list.tsx | 2 + .../ui/virtualized-list/VirtualizedList.tsx | 4 +- .../src/components/upload/useBatchUpload.ts | 3 +- apps/web/src/context/AudioContext.tsx | 1 + .../context/audio-context/AudioContext.tsx | 1 + .../analytics-page/AnalyticsView.stories.tsx | 1 - .../analytics-page/AnalyticsViewAudience.tsx | 11 +-- .../AnalyticsViewMarketplace.tsx | 11 +-- .../analytics-page/AnalyticsViewSales.tsx | 11 +-- .../register-page/RegisterPage.stories.tsx | 1 - .../sessions-page/SessionsPage.stories.tsx | 3 - .../chat/components/ChatInput.test.tsx | 11 ++- .../chat/components/ChatInterface.stories.tsx | 1 - .../chat/components/MentionAutocomplete.tsx | 3 +- .../components/VirtualizedChatMessages.tsx | 1 + apps/web/src/features/chat/store/chatStore.ts | 36 +++++----- .../checkout/CheckoutCompletePage.tsx | 5 +- .../features/discover/pages/DiscoverPage.tsx | 16 +++-- .../components/GearImageGallery.stories.tsx | 1 + .../inventory/components/GearImageGallery.tsx | 5 +- .../components/gear/GearCard.stories.tsx | 1 + .../live/pages/live-page/LiveView.stories.tsx | 1 - .../NotificationsPage.stories.tsx | 3 - .../notifications-page/NotificationsPage.tsx | 1 + .../player/components/PlayerQueue.tsx | 5 +- .../features/player/services/playerService.ts | 11 +-- .../components/PlaylistAnalytics.tsx | 1 + .../PlaylistBatchActions.stories.tsx | 1 + .../components/PlaylistErrorBoundary.tsx | 1 + .../playlists/components/PlaylistList.tsx | 1 + .../hooks/usePlaylistNotifications.ts | 60 ++++++++++------- .../pages/PlaylistDetailPage.test.tsx | 1 + .../features/presence/hooks/usePresence.ts | 5 +- .../profile/components/AvatarUpload.test.tsx | 3 +- .../components/ProfileSocialLinksSection.tsx | 1 + .../user-profile-page/useUserProfilePage.ts | 10 ++- .../purchases-page/PurchasesView.stories.tsx | 1 - .../roles/components/AssignRoleModal.test.tsx | 12 +++- .../search-page/SearchPage.stories.tsx | 3 - .../settings/components/AccountSettings.tsx | 1 + .../components/PresenceInvisibleToggle.tsx | 5 +- .../components/ProfileVisibilityCard.tsx | 11 ++- .../pages/social-page/SocialViewFeedItem.tsx | 4 +- .../components/PlaybackHeatmap.stories.tsx | 2 - .../playback-heatmap/usePlaybackHeatmap.ts | 7 +- .../hooks/useBitrateAdaptation.test.ts | 2 + .../streaming/hooks/useHLSStream.test.ts | 1 + .../subscription/pages/SubscriptionPage.tsx | 2 +- .../components/CommentThread.stories.tsx | 4 ++ .../tracks/components/TrackFilters.tsx | 1 + .../tracks/components/TrackGrid.test.tsx | 4 +- .../tracks/components/TrackList.test.tsx | 15 +++-- .../tracks/components/TrackSearchFilters.tsx | 1 + .../tracks/components/TrackStemsSection.tsx | 2 +- .../comment-thread/CommentThreadContent.tsx | 4 +- .../comment-thread/useCommentReplies.ts | 2 +- .../tracks/hooks/useInfiniteScroll.test.ts | 14 ++-- .../tracks/hooks/useTrackList.test.ts | 1 + .../src/features/tracks/hooks/useTrackList.ts | 19 +++--- .../tracks/services/chunkedUploadService.ts | 10 +-- apps/web/src/hooks/useSeason.ts | 4 ++ apps/web/src/hooks/useTimeOfDay.ts | 3 + apps/web/src/main.tsx | 4 +- apps/web/src/providers/AuthProvider.tsx | 1 + apps/web/src/router/routeConfig.tsx | 1 + apps/web/src/services/api/auth.ts | 5 +- .../src/services/api/interceptors/response.ts | 7 +- apps/web/src/services/api/search.ts | 2 +- apps/web/src/services/offlineQueue.test.ts | 6 +- apps/web/src/services/pwa.ts | 20 +++--- apps/web/src/services/requestDeduplication.ts | 11 +-- apps/web/src/services/responseCache.ts | 11 +-- apps/web/src/services/tokenRefresh.ts | 3 +- apps/web/src/test/helpers.tsx | 2 + apps/web/src/test/test-utils.tsx | 2 + apps/web/src/utils/contrast.ts | 18 +++-- apps/web/src/utils/sanitize.ts | 11 +-- 100 files changed, 386 insertions(+), 234 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1a2e6a878..35c92268f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -124,14 +124,19 @@ jobs: working-directory: apps/web - name: Lint - # ESLint warning baseline freeze (v1.0.10 polish): - # 1204 is the current count of legacy warnings (mostly the - # custom no-restricted-syntax 721, plus @typescript-eslint - # no-non-null-assertion 139, no-unused-vars 134, - # no-explicit-any 115, react-hooks/exhaustive-deps 47). - # CI fails on ANY new warning. Lower this number as warnings - # are resorbed by feature work; never raise it. - run: npx eslint --max-warnings=1204 . + # ESLint warning baseline (v1.0.10 dette tech). + # Lowered from 1204 → 1108 after no-unused-vars sprint + # (134 → 0). Top contributors at this baseline : + # 757 no-restricted-syntax (custom design-system rule — + # Tailwind defaults / hex literals / native