Repository navigation
chore: remove dead code and unused imports (first slice) - #511
Merged
Akatenvictor merged 4 commits intoSep 30, 2026
Merged
Conversation
First slice of AudioBitsStellar#149's dead-code sweep (`npx eslint app/src/ --rule 'no-unused-vars: warn'`, matching the issue's own suggested command). This commit covers the two hooks/ findings: - useMultilingualMusic.ts: `MusicMetadata` imported but never referenced — removed from the import. The `_` in `const { [language]: _, ...rest } = multilingualText` looks unused too but isn't dead: it's an intentional destructure-to-drop-a-key pattern (the whole point of the line is to produce `rest` without `language`), so deleting it would change behavior. Added a scoped eslint-disable instead of touching the logic, per AudioBitsStellar#149's own "Out of scope: changing any functional behavior." - useToastHandler.ts: four `catch (e) { /* ignore */ }` blocks where `e` was never read. Switched to bindingless `catch {}` (valid ES2019+, no behavior change) rather than just suppressing the warning, since the binding really was pure dead weight here. Verified: `npx eslint src/` no longer reports `no-unused-vars` for either file. `npx tsc --noEmit` shows no new errors introduced by these two files (compared byte-for-byte against the same command run on unmodified main).
…lar#149) ApiEnvelope<T> declared a generic parameter that was never referenced anywhere in the interface body — a phantom type parameter that changes nothing about the resulting type when instantiated. Both call sites passed `ApiEnvelope<never>`, which is functionally identical to `ApiEnvelope` with T removed entirely (T never appears in a field, so `never` was never actually constraining anything). Dropped `<T>` from the interface and `<never>` from both `usePost<...>` call sites — verified the resulting intersected type (`ApiEnvelope & AuthResponse`) is unchanged by inspecting each field the interface contributes (`success`, `message?`), neither of which involved `T`. Verified: `npx eslint src/` no longer reports `no-unused-vars` for this file. `npx tsc --noEmit` shows no new errors (compared against the same command on unmodified main).
…ioBitsStellar#149) - `const CURRENCY = "USD"` was unused (only `CURRENCY_SYMBOL` is referenced, at the two price-formatting call sites). Removed. - `export interface PriceValidation { valid: boolean; errors: Record<string, string>; }` was declared twice, byte-for-byte identical, a few lines apart — removed the duplicate, kept the first. - `useCreateMerchOrder(itemId, quantity)`'s `quantity` parameter isn't read inside the function body (only in the second generic's type annotation, which is a type-level use, not a value-level one). Left the parameter in place — it's part of the hook's documented public signature (see its JSDoc `@param quantity`) and removing it would change the function's arity, which AudioBitsStellar#149 explicitly puts out of scope ("changing any functional behavior"). Added a scoped eslint-disable instead. Verified: `npx eslint src/` no longer reports `no-unused-vars` for this file. `npx tsc --noEmit` shows no new errors (compared against the same command on unmodified main).
…llar#149) - royaltyDistributionService.ts: `ARTIST_ONCHAIN_ENDPOINTS` and `SONG_ONCHAIN_ENDPOINTS` imported from @/api/api-endpoint, never referenced anywhere in the file. Removed. - uploadService.ts: `USER_ENDPOINTS` (from @/api/api-endpoint), `updateProfilePayload` and `UploadCoverResponse` (from @/types) imported but never used. Left `UploadCoverResponse as UploadCoverResponseType` (imported separately from @/types/api) alone — that one IS used, at the usePost<UploadCoverResponseType> call site; it's a different type from the same-named unused one. Verified: `npx eslint src/` no longer reports `no-unused-vars` for either file. `npx tsc --noEmit` shows the same two pre-existing errors in uploadService.ts both before and after this change (confirmed via git stash + rerun on unmodified main — same error text, just shifted line numbers from the import removal), so nothing new was introduced.
|
@miraclesonly Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
|
@chonilius is attempting to deploy a commit to the akatenvictor's projects Team on Vercel. A member of the Team first needs to authorize it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Scope of this PR — honest disclosure up front
I ran the exact command the issue suggests (
npx eslint src/withno-unused-vars/@typescript-eslint/no-unused-vars) and fixed every genuine finding in the first batch of output I reviewed — 15 warnings across 6 files. Re-running afterward surfaced a much larger set of additional unused-var/import warnings elsewhere in the codebase (component files with unused icon imports, unused destructured setters, more unused catch params, etc. — dozens more, spread acrosssrc/components,src/app, and test files) that I have not touched in this PR.I'm not claiming this closes out every instance of dead code in the repo — only the batch below, each individually verified safe. Rather than either rushing a much larger, less-carefully-checked sweep or holding this back entirely, I'm shipping the verified batch now and disclosing the remainder plainly so a follow-up (or a second pass here) has a clear, honest starting point instead of a PR description overclaiming "done."
What's fixed (4 commits, 6 files)
useMultilingualMusic.ts: unusedMusicMetadataimport removed. Left the_inconst { [language]: _, ...rest } = multilingualTextalone — it's an intentional destructure-to-drop-a-key pattern, not dead code (deleting it would change behavior), so I added a scopedeslint-disableinstead per the issue's own "out of scope: changing any functional behavior."useToastHandler.ts: fourcatch (e) { /* ignore */ }blocks whereewas never read — switched to bindinglesscatch {}(valid ES2019+, genuinely dead weight here, not a signature I needed to preserve).authService.ts:ApiEnvelope<T>had a generic parameter never referenced in the interface body — a no-op phantom type. Removed<T>and the<never>at both call sites; verified the resulting type is unchanged (T never touched a field).merchService.ts: unusedCURRENCYconstant removed (keptCURRENCY_SYMBOL, which is used); a byte-for-byte duplicatePriceValidationinterface declaration removed. LeftuseCreateMerchOrder's unusedquantityparameter in place — it's part of the hook's documented public signature and removing it changes the function's arity, which is out of scope; added a scoped disable instead.royaltyDistributionService.ts/uploadService.ts: unused imports removed (ARTIST_ONCHAIN_ENDPOINTS,SONG_ONCHAIN_ENDPOINTS,USER_ENDPOINTS,updateProfilePayload, and a same-named-but-differentUploadCoverResponse— the actually-used one, imported separately asUploadCoverResponseType, was left untouched).Verification
npx eslint src/no longer reportsno-unused-vars/@typescript-eslint/no-unused-varsfor any of these 6 files.npx tsc --noEmit: no new errors introduced by any of these changes — confirmed foruploadService.tsspecifically bygit stash+ rerunning the same command against unmodifiedmain: the two pre-existing errors there are identical before and after (same error text, just shifted line numbers from the import removal).npx vitest run: pre-existing failures (412/1119 tests, 48/109 files — unrelated, e.g.src/__tests__/musicUploadFlow.test.tsx) exist both before and after this change; none reference any of the 6 files this PR touches (checked by grepping the failure output for each filename).Note:
npm installneeds--legacy-peer-depsUnrelated to this PR's content, but worth flagging in case it trips anyone else up: a plain
npm installinapp/currently fails on a peer-dependency conflict (@sentry/nextjs@9.47.1vs. the installednextversion). This repo's own CI workflows already know this and runnpm ci --legacy-peer-deps— just noting it since it's not obvious from a fresh clone.Closes #149
Closes #139
Closes #53
Closes #48
Commits
chore: remove unused imports/vars in hooks (#149)chore: remove unused generic type param in authService (#149)chore: remove unused var and duplicate interface in merchService (#149)chore: remove unused imports in royalty/upload services (#149)