What's new in v0.4.0
Phase 2 — Cross-file dead code detection
unused-export (warning, weight 8) — named exports never imported anywhere
dead-file (warning, weight 10) — source files never imported by anything
unused-dependency (warning, weight 6) — packages in package.json never imported
Phase 3 — Structural architecture analysis
circular-dependency (error, weight 14) — circular import chains via DFS. Reports full cycle: A → B → C → A
layer-violation (error, weight 16) — imports that cross architectural layers (requires drift.config.ts)
cross-boundary-import (warning, weight 10) — imports across module boundaries (requires drift.config.ts)
Phase 4 — Historical comparison
drift diff [ref] — compare current state vs any git ref (commit, branch, tag)
- Default:
HEAD~1. Shows score delta, new issues, and resolved issues per file
- Uses
git show — non-destructive, no checkout, no stash
--json flag for CI consumption
Configuration (optional)
// drift.config.ts
import type { DriftConfig } from '@eduardbar/drift'
export default {
layers: [
{ name: 'domain', patterns: ['src/domain/**'], canImportFrom: [] },
{ name: 'app', patterns: ['src/app/**'], canImportFrom: ['domain'] },
{ name: 'infra', patterns: ['src/infra/**'], canImportFrom: ['domain', 'app'] },
],
} satisfies DriftConfig
21 rules total | Score 0–100 | Zero config for 19 of them
npx @eduardbar/drift@0.4.0 scan .
npx @eduardbar/drift@0.4.0 diff HEAD~1