Skip to content

Conversation

@faridsalau
Copy link
Contributor

@faridsalau faridsalau commented Jan 3, 2025

Description

This PR removes several unused exports across the web package that were identified using ts-unused-exports. I've manually verified that these exports are not being used anywhere in the codebase.

Changes

  • Removed unused exports or converted them to local declarations across several files

Details

Using the command npx ts-unused-exports packages/web/tsconfig.json, I identified several exports that weren't being used. After manual verification to ensure these weren't being used through dynamic imports or other means, I removed or converted them to local declarations.

Key changes include:

  • Converting exported types to local types (e.g., HistoryContextType, RetrieveCollectionsConfig)
  • Removing unused constants (e.g., USER_INITIAL_LOAD_COUNT, MAX_REMIXERS)
  • Removing unused selectors from the sign-on store
  • Cleaning up legacy code (commented out components, unused utility functions)

Why This Matters

Unused exports in TypeScript projects can cause several issues:

  1. Bundle Size: Even with tree-shaking, some bundlers might not correctly identify unused exports, leading to larger bundle sizes (vite shouldn't have this problem though)
  2. Maintenance Overhead: Exported values imply an API contract that needs to be maintained, even if unused
  3. Code Clarity: Unused exports can mislead developers about what parts of the code are actually being used
  4. Type Definition Bloat: In TypeScript projects, unused type exports still end up in declaration files, making them larger and slower to process

This is one of several PRs aimed at cleaning up unused exports across our codebase. Future PRs will address other packages.

How Has This Been Tested?

  • Manually verified that removed exports weren't being used through dynamic imports or other means
  • Tested the application locally to ensure no runtime issues

@changeset-bot
Copy link

changeset-bot bot commented Jan 3, 2025

⚠️ No Changeset found

Latest commit: 02dea63

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@faridsalau faridsalau changed the title Remove dead code [PAY-3750] Remove dead code in web - part 1 Jan 3, 2025
Copy link
Contributor

@dylanjeffers dylanjeffers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

great stuff!

@faridsalau faridsalau merged commit 0a000c7 into main Jan 3, 2025
7 checks passed
@faridsalau faridsalau deleted the farid/remove-dead-code-web-1 branch January 3, 2025 02:32
audius-infra pushed a commit that referenced this pull request Jan 4, 2025
[6928844] Revert tan-query changes on main (#10907) Andrew Mendelsohn
[0f13539] [PAY-3750] Remove unused exports and dead code - part 4 (#10903) Farid Salau
[fd2da0c] Switch react-lottie for lottie-react (#10905) Raymond Jacobson
[4d79dda] [PAY-3750] Remove unused exports and dead code - part 3 (#10902) Farid Salau
[3f3cc26] [PAY-3750] Remove unused exports and dead code - part 2 (#10901) Farid Salau
[f5fc67b] Fix wrong data getting written to queryClient (#10900) Andrew Mendelsohn
[0a000c7] [PAY-3750] Remove dead code in web - part 1 (#10897) Farid Salau
[3074cc2] [PAY-3729] Fix issues with cover photos and challenges (#10891) Randy Schott
[81f9d83] [C-5588] Replace useGetTrackById usages with useTrack (#10889) Andrew Mendelsohn
[b6c0d5f] [PAY-3741] Fix playback immediately after purchase (#10895) Raymond Jacobson
[f882ea1] Refactor primeData helpers (#10893) Andrew Mendelsohn
[eeaa32d] Fix cache syncing (#10894) Dylan Jeffers
[954e931] Misc web package cleanup (#10885) Raymond Jacobson
[cf1aff3] [C-5589] Migrate collections to react query (#10886) Dylan Jeffers
[6c82c79] Fix mobile prettier (#10888) Dylan Jeffers
[067a5ec] [PAY-3740] Stop propagation on gated conditions pill (#10887) Raymond Jacobson
[5301258] Fix SSR rendering issues (#10884) Randy Schott
[ffdf3bd] [PAY-3739] Fix folder expansion (#10883) Raymond Jacobson
[99dc254] [C-5587] Migrate users hooks to react query (#10881) Dylan Jeffers
[3c1ce7c] [PAY-3748] Fix logged out SDK initialization (#10873) Marcus Pasell
[496e3b4] Fix various console warnings (#10872) Dylan Jeffers
[5e8699b] Small fix to mobile edit trackform to show artwork on upload (#10880) Kyle Shanks
[553e251] [C-5582] Fix icon fill warning (#10861) Dylan Jeffers
[614ece7] [C-5581] Remove default props (#10860) Dylan Jeffers
[3ba3784] Fix web tests due to redux-first-history migration (#10874) Dylan Jeffers
[2e4ff12] [C-5578] Replace connected-react-router with redux-first-history (#10858) Dylan Jeffers
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants