React 19 Migration Safety Net
Automated CLI tool that statically analyzes React 16/17/18 codebases for 25+ deprecated API patterns, with AST-based rule engine, risk scoring, and CI enforcement.
Overview
An automated TypeScript CLI tool that helps teams safely upgrade React applications from version 16/17/18 to React 19. It statically analyzes codebases for deprecated APIs, scores migration risk, enforces CI policies, and generates human-readable reports — without touching a single line of production code until you're ready.
The Problem
React 19 removes many APIs that teams have relied on for years. Without automated detection, upgrading means manually auditing thousands of files hoping to catch every deprecated pattern before your users do.
What I Built
- 1A 4-package TypeScript monorepo: analyzer (AST scanning), runtime (execution engine), reporter (output formatting), and CLI (Commander.js interface).
- 2AST-based rule engine using Babel parser that detects 25+ deprecated React API patterns with exact file, line, and column locations plus migration guidance for each violation.
- 3Risk scoring system (0–100) that weights violations by severity — critical APIs that will crash get higher weight than deprecation warnings.
- 4Configurable severity policies — teams can set thresholds per severity level and fail CI only for violations that matter to their codebase.
- 5GitHub Actions, GitLab CI, and Jenkins integration that blocks PRs containing critical deprecated APIs.
- 6JSON and console output formatting — pipe into other tools or read in the terminal.
- 7101 passing tests with 100% TypeScript coverage across all packages.
Key Technical Decisions
AST-based static analysis
Uses Babel parser to walk the AST of every source file, not just string search. Catches dynamic usage patterns, aliased imports, and spread patterns that regex-based tools miss.
Risk scoring (0–100)
Each violation is weighted by impact — a createRef call scores differently from an unsafe lifecycle method. The aggregate score lets teams prioritize remediation instead of drowning in a flat violation list.
CI policy enforcement
The CLI exits with a non-zero code when violations exceed configured thresholds. Drop it into any CI pipeline and deprecated APIs will block merges automatically.
Outcome
A complete migration safety toolkit covering detection, scoring, reporting, and CI enforcement. 101 tests, 100% TypeScript coverage, and documented integration guides for three CI platforms.
What I Learned
AST traversal is powerful but verbose — writing a clean rule engine that's easy to extend with new detectors required careful abstraction. The visitor pattern made individual rules simple while the engine handled traversal.