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

3.2 KiB

Specification Quality Checklist: Refactor Earn Feature

Purpose: Validate specification completeness and quality before proceeding to planning Created: 2026-01-15 Feature: spec.md

Content Quality

  • No implementation details (languages, frameworks, APIs)
  • Focused on user value and business needs
  • Written for non-technical stakeholders
  • All mandatory sections completed

Requirement Completeness

  • No [NEEDS CLARIFICATION] markers remain
  • Requirements are testable and unambiguous
  • Success criteria are measurable
  • Success criteria are technology-agnostic (no implementation details)
  • All acceptance scenarios are defined
  • Edge cases are identified
  • Scope is clearly bounded
  • Dependencies and assumptions identified

Feature Readiness

  • All functional requirements have clear acceptance criteria
  • User scenarios cover primary flows
  • Feature meets measurable outcomes defined in Success Criteria
  • No implementation details leak into specification

Validation Results

Status: ✅ PASSED

All checklist items have been validated and the specification is ready for planning.

Content Quality Assessment

  • The specification focuses on structural refactoring patterns without specifying how to implement them (e.g., "MUST have standard folder structure" not "MUST use webpack for bundling")
  • The user stories describe developer workflows and structural outcomes, not implementation details
  • Language is accessible to product managers and technical stakeholders
  • All mandatory sections (User Scenarios, Requirements, Success Criteria) are complete

Requirement Completeness Assessment

  • No [NEEDS CLARIFICATION] markers exist in the specification
  • All functional requirements are testable (e.g., "folder structure matches pattern", "bundle analysis confirms code splitting")
  • Success criteria use measurable metrics (e.g., "100% compliance", "all tests pass", "zero deep imports")
  • Success criteria avoid implementation (e.g., "bundle analysis confirms separate chunk" not "webpack creates separate bundle")
  • All user stories have acceptance scenarios in Given-When-Then format
  • Edge cases cover feature flag states, external component usage, and analytics
  • Scope is bounded to structural refactoring with no functional changes
  • Assumptions document constraints and existing system dependencies

Feature Readiness Assessment

  • Each functional requirement maps to user stories with acceptance criteria
  • User scenarios cover folder restructuring, API boundaries, lazy loading, type definitions, and functionality preservation
  • Success criteria are independently verifiable without implementation knowledge
  • The specification maintains separation between WHAT needs to be achieved and HOW it will be implemented

Notes

This specification is a pure refactoring effort based on an established pattern documented in 001-feature-architecture. The quality is high because:

  1. It references an existing, proven pattern
  2. It has clear, measurable compliance criteria
  3. It emphasizes preservation of existing functionality
  4. It focuses on structural outcomes rather than implementation choices

The specification is ready for /speckit.plan to create detailed implementation tasks.