Files
9dede308db refactor(web): add knip for unused exports detection + remove dead code (#7022)
* chore(web): add knip for unused exports detection

Add knip to detect unused exports in barrel files, helping prevent
accidental bundling of heavy internal modules. Includes:

- knip.json configuration
- yarn knip and knip:exports scripts
- CI workflow job to run knip on PRs

* chore(web): exclude Mui index from Knip analysis

Add src/components/common/Mui/index.tsx to Knip ignore list as it
contains exports used as webpack aliases that Knip cannot trace.

* refactor: remove unused exports found by knip

- Remove unused exports (ExecuteCheckboxSlot, withSuspense, useIsGeoblockedFeatureEnabled, addUndeployedSafes)
- Remove unused exported types (TxStep, FeatureContract, PayNowPayLaterProps, CounterfactualFormProps, FirstTxFlowProps, CounterfactualContract, ShowHashFunction, HideHashFunction, SafeOrMultichainSafe, WalletConnectContract)
- Delete completely unused internal functions and unused imports
- Fix duplicate exports in components and hooks by keeping default exports only
- Update imports across codebase to use default exports consistently
- Fix test mocks for useChainId to mock 'default' export

All knip:exports findings have been addressed except for false positives (setTransactionExecution is actually used, and ContractErrorCodes enum members are intentionally kept as complete error code reference).

* fix: prefix unused internal variables with underscore

* fix: prefix all unused variables with underscore to pass lint

* fix: remove completely unused ChainIndicatorWithFiatBalance component

* fix: remove unused imports created by deleting ChainIndicatorWithFiatBalance

* fix: restore useChainId import that is actually used

* fix: prefix all remaining unused variables with underscore

* fix: delete truly unused functions and constants

* fix: complete cleanup of unused functions and simplify withSuspense file

* fix: remove unused type guard functions

* fix: remove MULTISEND_METHOD and APPROVE_METHOD unused constants

* chore: fix lint errors from knip cleanup

- Remove unused imports from approvals.ts
- Delete unused builder functions from swapOrderBuilder.ts
- Remove unused WalletConnectContract interface
- Restore SafeTxHashDataRow hooks (useDomainHash, useMessageHash, useSafeTxHash)
- Delete test file for deleted HnSecurityReportBtnWithTxHash component

All tests pass and build succeeds.

* chore: fix knip false positives and remove unused exports

- Remove unused exports: isWebhookEvent, selectSafeAddress
- Configure knip to ignore Redux slice files (false positives from destructured exports)
- Configure knip to ignore contract error codes, webhook types, and feature contract types
- All knip checks now pass

* chore: delete completely unused isWebhookEvent function

The function was not used anywhere in the codebase, so removing it entirely.

* chore: add apps/web/out to .prettierignore

The out/ directory contains build artifacts that shouldn't be checked by prettier.

---------

Co-authored-by: Hanzo Dev <[email protected]>
2026-01-27 15:54:12 +01:00
..
…
…