Skip to content

Audit duplicate textColorClasses implementations (app vs shared) #491

Description

@Jagadeeshftw

📌 Description

Both src/app/utils/textColorClasses.ts and src/shared/utils/textColorClasses.ts exist (the shared one already has a dedicated test file). Having two implementations of the same-sounding utility risks them drifting apart, with different components picking inconsistent text-color logic depending on which import path they happen to use.

🧩 Requirements and context

  • Compare both implementations and determine if they're identical, overlapping, or genuinely different in scope.
  • If overlapping: consolidate on src/shared/utils/textColorClasses.ts and update all src/app/... imports; delete the duplicate.
  • If genuinely different: rename one to disambiguate intent and document why both exist.

Non-functional requirements

  • Must be secure, tested, and documented.
  • Should be efficient and easy to review.

🛠️ Suggested execution

1. Fork the repo and create a branch

git checkout -b refactor/consolidate-text-color-classes

2. Implement changes

  • Modify: src/app/utils/textColorClasses.ts and src/shared/utils/textColorClasses.ts — consolidate or disambiguate.
  • Modify: any importers of the removed/renamed file.

3. Test and commit

  • Run tests:
npm test -- run textColorClasses
  • Cover edge cases: a component importing the app-local version after consolidation (should now resolve to shared or fail the build clearly), a color-class name present in one implementation but not the other.
  • Include test output and details in the PR description.

Example commit message

refactor: consolidate duplicate textColorClasses implementations

✅ Acceptance criteria

  • Only one canonical implementation remains, or the two are clearly renamed to reflect distinct purposes.
  • No visual regression in components previously using either version (spot-checked).
  • Existing tests for the shared version still pass; app-local tests (if any) are merged in or removed appropriately.

🔒 Security notes

None beyond standard regression risk from the refactor — this is a maintainability issue, not a security one.

📋 Guidelines

  • Minimum 95% test coverage
  • Clear documentation
  • Timeframe: 96 hours

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions