Skip to content

Remove barrel exports (index.ts files) in favor of direct imports #289

Description

@zalexa19

Description

Our codebase currently uses barrel exports (index.ts files) throughout the project, particularly in /src/components/index.ts. While this pattern provides shorter import paths, it has several drawbacks:

  • Circular dependency risks: Barrel exports can create circular dependency issues that are hard to debug
  • Poor tree-shaking: Bundlers may include unused code, resulting in larger bundle sizes
  • Reduced code clarity: It's harder to trace where components actually live
  • Maintenance overhead: Need to manually maintain export lists
  • IDE performance: Can slow down IntelliSense and auto-imports

Proposed Solution

Migrate from barrel exports to direct imports across the codebase.

Before:

// src/components/index.ts
export * from '../features/trainee-profile/profile/components/TraineeProfile';
export * from '../features/trainee-profile/education/EducationInfo';

// Usage
import { TraineeProfile, EducationInfo } from '@/components';

After:

// Direct imports
import { TraineeProfile } from '@/features/trainee-profile/profile/components/TraineeProfile';
import { EducationInfo } from '@/features/trainee-profile/education/EducationInfo';

Metadata

Metadata

Assignees

No one assigned

    Labels

    FEFrontend ticket

    Type

    Fields

    No fields configured for Task.

    Projects

    Status
    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions