Skip to content

[Modifications] Adopt path aliases consistently instead of deep relative imports #1025

Description

@RUKAYAT-CODER

Overview

tsconfig.json defines nine path aliases and jest.config.js mirrors seven of them, but the codebase overwhelmingly uses relative imports — ../../config, ../../store, ../../utils/logger — up to three levels deep. The useProfileData.ts bug (three imports with one ../ too many, breaking the module) is a direct consequence: relative depth is easy to get wrong and invisible in review. The alias definitions in tsconfig.json and jest.config.js have also drifted; @/components/* and @/constants/* exist in one and not the other.

Specifications

Features:

  • Aliases used for all cross-directory imports; relative paths only within a directory
  • Alias definitions synchronised across tsconfig.json, jest.config.js and babel.config.js
  • A lint rule discouraging ../../ and deeper

Tasks:

  • Reconcile the alias lists across the three configuration files
  • Codemod cross-directory relative imports to aliases
  • Add no-restricted-imports forbidding patterns with two or more ../ segments
  • Verify Metro resolves the aliases in a production export

Impacted Files:

  • tsconfig.json
  • jest.config.js
  • babel.config.js
  • metro.config.js
  • src/

Acceptance Criteria

  • No import contains ../../
  • Alias definitions are identical across all configs
  • A production export resolves all aliases

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions