Skip to content

chore(code-quality): magic numbers not named, TODO comments in source instead of issue refs, raw template literals not using cn() #206

Description

@k-deejah

Problem

Three issues affect the overall code quality, maintainability, and consistency of the component library.

1. Multiple components have inline magic numbers with no named constants

truncateAddress default values start=6, end=4, PAGE_SIZE=10 in TransactionHistory, pollInterval defaults, and pixel sizes like size * dpr in QRCode are magic numbers scattered through the codebase. Extracting them to named constants (e.g. const DEFAULT_TRUNCATE_START = 6) would make the intent clearer and changes easier.

2. TODO comments in SorobanInvokeButton and main.tsx are tracked as code comments not issues

// TODO: Implement contract invocation and similar comments should not live in source code — they are tracked as GitHub issues. Dead TODO comments that have corresponding open issues should be replaced with // See issue #22 references.

3. Components inconsistently use cn() from @/lib/utils vs raw template literals

Some className concatenations use cn(...) correctly, others use raw template literals like `... ${condition ? 'class-a' : 'class-b'}`. This inconsistency makes it harder to search for class usage and defeats tailwind-merge's deduplication. All conditional class logic should use cn().

Solution

  1. Extract magic numbers to named constants in their respective files.
  2. Replace TODO comments with // See issue #N references to the tracking issue.
  3. Audit all components and replace raw template literal class concatenation with cn().

Acceptance Criteria

  • No magic numbers in component logic — all extracted to named constants
  • No TODO comments — replaced with issue references
  • All conditional classNames use cn() from @/lib/utils
  • npm run lint passes with no warnings
  • npm run build passes

Note for Contributors: Write a clear PR description. List every file modified and the magic numbers or TODOs replaced. Run grep -r "TODO" src/ before and after to confirm zero remaining TODOs.

Metadata

Metadata

Labels

Stellar WaveIssues in the Stellar wave programenhancementNew feature or request

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions