Description
The codebase mixes absolute (src/core/auth/...) and relative (../../core/auth/...) import styles. Relative imports are fragile — any file move breaks them, as demonstrated by the build failures in delegation.service.ts and enhanced-auth.service.ts. The tsconfig.json already supports path aliases. Standardizing on src/-prefixed absolute imports eliminates an entire class of build errors.
Direction
- Confirm
tsconfig.json has "paths": { "src/*": ["src/*"] } (add if missing).
- Run a codebase-wide replacement:
- Replace all
from "../../ and from "../ relative imports that cross domain boundaries with from "src/... absolute imports.
- Keep same-directory relative imports (e.g.,
./dto/create-payload.dto) as-is — these are appropriate.
- Add an ESLint rule (
no-restricted-paths or import/no-relative-parent-imports) to enforce the convention going forward.
Definition of Done
- Every cross-directory import uses the
src/ absolute alias.
- Relative imports are only used for same-directory or direct-child references.
Acceptance Criteria
Description
The codebase mixes absolute (
src/core/auth/...) and relative (../../core/auth/...) import styles. Relative imports are fragile — any file move breaks them, as demonstrated by the build failures indelegation.service.tsandenhanced-auth.service.ts. Thetsconfig.jsonalready supports path aliases. Standardizing onsrc/-prefixed absolute imports eliminates an entire class of build errors.Direction
tsconfig.jsonhas"paths": { "src/*": ["src/*"] }(add if missing).from "../../andfrom "../relative imports that cross domain boundaries withfrom "src/...absolute imports../dto/create-payload.dto) as-is — these are appropriate.no-restricted-pathsorimport/no-relative-parent-imports) to enforce the convention going forward.Definition of Done
src/absolute alias.Acceptance Criteria
tsconfig.jsoncontains thesrc/*path alias../../to reach across domain boundariesnpm run lintpasses)npm run buildsucceedsnpm run testpasses