v0.2.2-beta

Reference

Presets.

Presets are named collections of rule severities you can extend in your config. ngcompass ships seven built-in presets. Start with ngcompass:recommended and layer additional presets as needed.

Usage

ngcompass.config.ts
01import { defineConfig } from '@ngcompass/config';
02
03export default defineConfig({
04 // Single preset:
05 // extends: 'ngcompass:recommended',
06
07 // Or layer multiple presets. Later entries win.
08 extends: ['ngcompass:recommended', 'ngcompass:ssr'],
09});

Built-in presets

  • ngcompass:recommendedrecommended15 rules

    High-confidence rules that prevent real bugs and regressions in any Angular project. Designed for teams at any modernization stage.

    Includescorrectness, RxJS memory safety, change detection, template performance, security, and focused-test checks

  • ngcompass:strict27 rules

    All built-in rules at error severity. Zero-tolerance mode for CI and teams that want every architectural, performance, migration, SSR, security, and testing violation enforced.

    Includesall 27 rules at error severity

  • ngcompass:performance8 rules

    Rules that directly impact Angular rendering and change-detection performance.

    IncludesOnPush, manual detectChanges(), template calls, trackBy, object/array literal bindings, async pipe duplication, and toSignal template-state guidance

  • ngcompass:reactivity13 rules

    Signals correctness and RxJS-to-Signals migration rules for Angular 17+ projects.

    IncludesRxJS subscription safety, Subject overuse, toSignal migration, signal purity, effect scoping, untracked usage, and modern signal I/O APIs

  • ngcompass:security2 rules

    XSS and sanitization bypass prevention rules. Useful as a standalone security-audit layer or on top of a custom base config.

    IncludesDomSanitizer bypass and unsafe template binding checks

  • ngcompass:ssr2 rules

    Platform safety rules for Angular SSR and Universal applications.

    Includesbrowser-global access and DOM work in lifecycle hooks that can break server rendering or hydration

  • ngcompass:all27 rules

    Every built-in rule enabled at its default severity. Useful for exploring the full rule surface on a new project.

    Includesall 27 rules

Inspect preset rules

Use the CLI to list all rules that would be active under a given preset:

bash
01npx ngcompass rules --preset recommended

Inspect a specific rule:

bash
01npx ngcompass rules prefer-on-push-component-change-detection

Overriding preset rules

You can turn off or adjust the severity of any rule inherited from a preset via the rules key:

typescript
01extends: 'ngcompass:recommended',
02rules: {
03 // Promote a warning to an error
04 'rxjs-avoid-subject-as-event-bus': 'error',
05 // Turn off a rule you don't want
06 'prefer-inject-over-constructor-di': 'off',
07}