Static analysis and functional verifier tool for React Router applications. CLI is rr.
src/cli.ts- CLI entry pointsrc/analyzer.ts- Main analysis orchestrationsrc/parsers/- AST parsers for routes, components, and actionssrc/checks/- Individual check implementations (links, forms, loader, params, hydration, interactivity, drizzle/persistence)src/sql/- SQL query extraction from ORM code (drizzle.ts, drizzle-operations.ts, types.ts)src/sql-extractor.ts- SQL extraction orchestration and formattingsrc/types.ts- Type definitionsscripts/build.mjs- esbuild bundler (bundles CLI + dependencies into single file)test/cli.test.ts- CLI integration tests (runs built artifact)test/fixtures/sample-app/- Test fixtures (realistic React Router app)
npm run build- Bundle with esbuild (outputs todist/)npm test- Run tests (vitest)
- Unit tests:
test/<name>-check.test.tsfor each check - CLI tests:
test/cli.test.tsruns the builtdist/cli.jsas a subprocess - CLI tests verify: build succeeds, version output, help output, file analysis, JSON format
- Test fixtures:
test/fixtures/sample-app/contains realistic route files
When fixing false positives or adding new features:
- Always add a test fixture - Create a realistic
.tsxfile intest/fixtures/sample-app/app/routes/that demonstrates the pattern - Add the route - Register new fixtures in
test/fixtures/sample-app/app/routes.ts - Write tests against the fixture - Tests should parse the fixture and verify the expected behavior
- Test both positive and negative cases - Ensure the check catches real issues AND doesn't flag valid patterns
Example fixture patterns:
intent-dispatch.tsx- Forms with intent-based dispatch (multiple forms, different intents)server-dates.tsx- Date operations in loader/action (should not flag hydration issues)hydration-safe.tsx- Safe hydration patterns (useEffect, suppressHydrationWarning, explicit timezone)hydration-issues.tsx- Real hydration issues (new Date() in render, Math.random(), window access)
- Never use emojis in output or code. Use plain text characters:
[x],[ ],->,*, etc.