@angular-health-check/cli
v0.1.1
Published
CLI tool to detect performance, architecture, and reactive pattern issues in Angular projects
Maintainers
Readme
@angular-health-check/cli
Static analysis tool for Angular projects. Detects Signals anti-patterns, RxJS memory leaks, performance issues, and code quality problems. Outputs a health score from 0 to 100.
Installation
npm install -g @angular-health-check/cliUsage
# Analyze an Angular project in the current directory
ahc scan .
# Analyze a specific path
ahc scan ./my-angular-app
# Generate an HTML report
ahc scan . --report
# Custom report output path
ahc scan . --report --output ./reports/health.html
# JSON output (for CI/CD pipelines)
ahc scan . --jsonOutput
───────────────────────────────────────────────────
Angular Health Check
───────────────────────────────────────────────────
Health Score 78 / 100 Good
Breakdown
Signals & Reactivity 85/100 =========.
RxJS 72/100 =======...
Performance 80/100 ========..
Files analyzed 42
Components 18
Signals 12
RxJS 8
Duration 1200ms
───────────────────────────────────────────────────
Warnings (2)
1. warning src/app/services/data.service.ts:25 rxjs/subscribe-without-cleanup
Observable subscription without cleanup — potential memory leak
Fix: Use takeUntilDestroyed() or unsubscribe in ngOnDestroyRules
Signals
| Rule | Severity | Description |
|------|----------|-------------|
| signals/effect-cleanup | warning | effect() without onCleanup or DestroyRef |
| signals/set-in-effect | info | Signal .set() inside effect() — use computed() instead |
RxJS
| Rule | Severity | Description |
|------|----------|-------------|
| rxjs/subscribe-without-cleanup | warning | .subscribe() without takeUntil, takeUntilDestroyed, or ngOnDestroy |
| rxjs/nested-subscribe | error | Nested .subscribe() calls — use switchMap or mergeMap |
Performance
| Rule | Severity | Description |
|------|----------|-------------|
| performance/missing-onpush | info | @Component without ChangeDetectionStrategy.OnPush |
| performance/ngfor-trackby | warning | *ngFor without trackBy |
| performance/console-log | info | console.log/warn/error in production code |
Scoring
The health score starts at 100 and is reduced based on issues found:
| Severity | Penalty | |----------|---------| | error | -10 per issue | | warning | -3 per issue | | info | -1 per issue |
| Score | Label | |-------|-------| | 90-100 | Excellent | | 70-89 | Good | | 50-69 | Fair | | 25-49 | Poor | | 0-24 | Critical |
CI/CD Integration
# .github/workflows/health-check.yml
- name: Angular Health Check
run: npx @angular-health-check/cli scan . --jsonThe process exits with code 1 when errors are found, 0 otherwise.
Requirements
- Node.js >= 18
- Angular project with TypeScript source files under
src/
License
MIT — Andres Felipe Leon Sanchez
