ng-reactive-lint ๐Ÿ› ๏ธ

August 1, 2025 ยท View on GitHub

An Angular-specific linter enforcing optimal reactivity patterns with Signals and RxJS

Features

  • ๐Ÿ›  Architecture Guards
    • Enforce takeUntilDestroyed() for subscription cleanup
    • Require OnPush with async pipes
  • โšก Performance Optimizations
    • Detect unnecessary change detection triggers
    • Identify overused RxJS operators
  • ๐Ÿšฆ Migration Ready
    • Suggest Signal conversions for RxJS chains
    • Highlight deprecated reactivity patterns

Installation

For Angular CLI Projects

ng add ng-reactive-lint

Standalone Usage

npm install -g ng-reactive-lint

Usage

Basic Linting

Use npx to run reactive-lint directly after installing it:

# Lint a specific file
npx reactive-lint src/app/my-component.ts

Lint all TypeScript files in a directory (use quotes for glob patterns)

npx reactive-lint "src/app/**/*.ts"

Lint your entire src directory

npx reactive-lint "src/**/*.ts"

๐Ÿ”ง Rules

Rule IDDescriptionFixableAngular-Only
no-implicit-subscriptionsRequires takeUntilDestroyed()โœ…Yes
no-async-without-onpushFlags missing OnPushโŒYes
prefer-signalSuggests Signal conversionsโœ…No
no-unused-observablesDetects unused RxJS streamsโŒNo

๐Ÿš€ Benchmark Results

MetricBad Code (Legacy RxJS)Good Code (Modern Signals)
Linting Time (avg)1.21 s1.86 s
Memory Usage152 MB251 MB

โš ๏ธ Note: The "good" code uses modern Angular patterns (toSignal, effect) which involve deeper AST structures and more reactive expressions. This naturally increases parsing time but reflects real-world adoption of Signals. The linter scales robustly with complexity.

๐Ÿš€ Development

Build

npm run build

Test

npm test

Run on Example Files

npm run lint-example

๐Ÿค Contributing

PRs welcome! See our Contribution Guide.

๐Ÿ“„ License

MIT ยฉ Shrinivass Arunachalam Balasubramanian