Skip to content

Rules

Every built-in check with its default severity and what it looks for. Generated from the rule registry, so this page always matches the CLI.

Severities are strict by default: correctness, security, and accessibility warnings count as errors. Soften or silence a rule in angular-doctor.config.json under rules. Run angular-doctor rules explain <id> in your terminal for the same details.

correctness (14)

angular-doctor/effect-writes-state

effect() writes state · default severity error · Angular ≥16

effect() writes state with set() or update().

angular-doctor/form-field-owned-attrs

formField owned attrs · default severity error

A [formField] element also binds an attribute the field owns.

angular-doctor/inject-async-target

injectAsync target · default severity error · Angular ≥22

injectAsync loads a service that is not auto-provided.

angular-doctor/ng-content-in-control-flow

ng-content in control flow · default severity error

<ng-content> sits inside control flow or an ng-template.

angular-doctor/ng-model-name

ngModel name · default severity error

[(ngModel)] without a name in a form.

angular-doctor/prefer-control-flow

Built-in control flow · default severity error · Angular ≥17

Legacy *ngIf, *ngFor, or *ngSwitch instead of built-in @if/@for/@switch.

angular-doctor/prefer-document-token

DOCUMENT token · default severity info

The global document is used instead of injecting DOCUMENT.

angular-doctor/prefer-standalone

Standalone · default severity error · Angular ≥17

An NgModule structure that modern Angular handles as standalone.

angular-doctor/prefer-take-until-destroyed

takeUntilDestroyed · default severity error · Angular ≥16

A destroy Subject is torn down in ngOnDestroy instead of takeUntilDestroyed().

angular-doctor/standalone-false

standalone: false · default severity error · Angular ≥17

A declaration sets standalone: false explicitly.

angular-doctor/strict-templates

Strict templates · default severity error

angularCompilerOptions.strictTemplates is not enabled.

Reference

angular-doctor/subject-not-cleaned-up

Subject cleanup · default severity error

A Subject is used and never completed or unsubscribed.

angular-doctor/template-arrow-not-called

Template arrow · default severity error

A template event binding is an arrow function that never runs as a call.

angular-doctor/typescript-strict

TypeScript strict · default severity error

compilerOptions.strict is not enabled.

Reference

performance (14)

angular-doctor/defer-missing-trigger

@defer without a trigger · default severity warning

@defer has no on/when/prefetch trigger, so the split buys nothing.

angular-doctor/explicit-eager-change-detection

Eager change detection · default severity info

ChangeDetectionStrategy.Default or Eager is set explicitly.

angular-doctor/getter-in-template

Getter in template · default severity error

A template reads a class getter, which re-runs on every change detection cycle.

angular-doctor/impure-pipe

Impure pipe · default severity error

A pipe declares pure: false and runs on every check.

angular-doctor/missing-for-track

Track in @for · default severity error · Angular ≥17

An @for block has no track expression.

angular-doctor/ng-src-dimensions

ngSrc dimensions · default severity warning

An ngSrc image is missing width or height and does not use fill.

angular-doctor/ng-src-fill-dimensions

ngSrc fill · default severity warning

A fill image also sets width or height.

angular-doctor/ng-src-placeholder-size

Placeholder size · default severity info

An ngSrc placeholder data URL decodes to more than 4 KB.

angular-doctor/prefer-http-resource

httpResource · default severity info · Angular ≥19

A component reads with HttpClient.get() where httpResource() fits.

angular-doctor/prefer-inject-async

injectAsync · default severity info · Angular ≥22

A root service is only used inside handlers and could load lazily.

angular-doctor/prefer-lazy-routes

Lazy routes · default severity info · Angular ≥19

A route eagerly imports its component instead of lazy loading.

angular-doctor/prefer-ng-optimized-image

NgOptimizedImage · default severity info

An <img> uses src instead of ngSrc with NgOptimizedImage.

angular-doctor/template-for-allocation

@for allocation · default severity info · Angular ≥17

@for iterates a method that returns a new array or object each call.

angular-doctor/zone-js

zone.js runtime · default severity warning · Angular ≥20

zone.js is still installed or imported on Angular 20+.

Reference

maintainability (34)

angular-doctor/complex-component

Complex component · default severity info

A component exceeds template, method, or control-flow size limits.

angular-doctor/deprecated-animations

Deprecated animations package · default severity error

package.json still lists the legacy @angular/animations package.

angular-doctor/deprecated-incremental-hydration

Incremental hydration · default severity warning · Angular ≥22

withIncrementalHydration() used on Angular 22+.

angular-doctor/generic-event-handler

Generic event handler name · default severity warning

An event handler is named handleX instead of after the action it performs.

angular-doctor/host-via-element-ref

Host via ElementRef · default severity info

Host classes, styles, or attributes set through nativeElement.

angular-doctor/inject-pipe

Injected pipe · default severity warning

A pipe class is injected like a service.

angular-doctor/input-dom-name

Input DOM name · default severity info

An input shadows a DOM property name like id or title.

angular-doctor/lifecycle-hook-complexity

Lifecycle hook complexity · default severity warning

A lifecycle hook does heavy work instead of delegating.

angular-doctor/lifecycle-interface

Lifecycle interface · default severity warning

A lifecycle hook is declared without implementing its interface.

angular-doctor/member-order

Member order · default severity warning

Injected fields and inputs should come before methods.

angular-doctor/ng-deep

ng-deep · default severity warning

::ng-deep, /deep/, or >>> pierces view encapsulation.

Reference

angular-doctor/one-concept-per-file

One concept per file · default severity warning

One file declares several @Component classes.

angular-doctor/output-name

Output name · default severity info

An output is named on… or after a DOM event like click.

angular-doctor/pipe-name-hyphen

Pipe name hyphen · default severity warning

A pipe name contains a hyphen instead of camelCase.

angular-doctor/prefer-class-binding

Class bindings · default severity info

[ngClass] used instead of a class binding.

angular-doctor/prefer-common-imports

Explicit imports · default severity info · Angular ≥17

CommonModule imported instead of only the used directives and pipes.

angular-doctor/prefer-functional-interceptor

Functional interceptor · default severity warning

A class-based HTTP interceptor instead of a functional one.

angular-doctor/prefer-host-bindings

Host bindings · default severity error

@HostBinding or @HostListener instead of the host decorator option.

angular-doctor/prefer-inject

inject() · default severity warning

Constructor parameter injection instead of the inject() function.

angular-doctor/prefer-is-dev-mode

isDevMode · default severity info

environment.production used instead of isDevMode().

angular-doctor/prefer-output-fn

output() · default severity info · Angular ≥19

@Output decorator instead of the output() API.

angular-doctor/prefer-provide-http-client

provideHttpClient · default severity warning

HttpClientModule instead of provideHttpClient().

angular-doctor/prefer-readonly-signals

Readonly signal APIs · default severity warning

Signal-based fields should be readonly so the reference cannot be swapped.

angular-doctor/prefer-router-module-testing

Router testing · default severity warning

Deprecated RouterTestingModule usage.

angular-doctor/prefer-service-decorator

@Service · default severity info · Angular ≥22

@Injectable({providedIn: "root"}) where the @Service decorator applies.

angular-doctor/prefer-signal-forms

Signal forms · default severity info · Angular ≥22

Reactive or template-driven forms where Signal Forms apply.

angular-doctor/prefer-signal-input

Signal inputs · default severity info · Angular ≥19

@Input decorator instead of the signal-based input() API.

angular-doctor/prefer-signal-query

Signal queries · default severity warning · Angular ≥19

@ViewChild/@ContentChild decorators instead of signal queries.

angular-doctor/prefer-style-binding

Style bindings · default severity info

[ngStyle] used instead of a style binding.

angular-doctor/query-in-lifecycle

Query in lifecycle · default severity info · Angular ≥17

A signal query is read in AfterViewInit/AfterContentInit.

angular-doctor/repeated-component-logic

Repeated component logic · default severity info

A method body matches a method in another component.

angular-doctor/repeated-template

Repeated template · default severity info

The same template block appears in another component.

angular-doctor/tailwind-v3-syntax

Tailwind v3 syntax · default severity warning

Tailwind v3 syntax remains while Tailwind 4 is installed.

angular-doctor/template-complexity

Template complexity · default severity warning

A template expression is complex enough to move into computed().

security (5)

angular-doctor/client-secret

Client secret · default severity error

A string literal in client code looks like a secret.

Reference

angular-doctor/env-file

Environment file · default severity error

A .env file is present in the project tree.

Reference

angular-doctor/inner-html

innerHTML · default severity error

A binding or assignment uses innerHTML.

Reference

angular-doctor/security-bypass

Security bypass · default severity error

DomSanitizer bypass call such as bypassSecurityTrustHtml.

angular-doctor/target-blank

target blank · default severity error

target="_blank" is missing rel="noopener" or rel="noreferrer".

Reference

accessibility (4)

angular-doctor/click-without-keyboard

Click keyboard path · default severity error

A non-interactive element has click and no keyboard handler.

Reference

angular-doctor/control-missing-label

Control label · default severity error

A form control has no accessible label.

Reference

angular-doctor/img-alt

Image alt text · default severity error

An img has neither alt nor aria-hidden="true".

Reference

angular-doctor/positive-tabindex

Positive tabindex · default severity error

tabindex is greater than 0.

Reference

hygiene (10)

angular-doctor/cleanup-unused-imports-hint

Unused import · default severity info

A named import is never used in the file.

Reference

angular-doctor/component-file-set-mismatch

Component file set mismatch · default severity warning

Component has no template file sharing its base name.

angular-doctor/file-hyphen-case

Hyphenated file names · default severity warning

File name is not hyphenated kebab-case.

angular-doctor/filename-class-mismatch

Filename class mismatch · default severity warning

File stem does not match the exported class name.

angular-doctor/generic-filename

Generic file name · default severity warning

File is named helpers, utils, or common.

angular-doctor/missing-spec-file

Missing spec file · default severity warning

A component, directive, pipe, or service has no sibling .spec.ts file.

angular-doctor/naming-convention-mix

Mixed naming conventions · default severity warning

A folder mixes .component.ts and suffixless component file names.

angular-doctor/project-layout

Project layout · default severity warning

Application has no bootstrap entry at its source-root main.ts.

angular-doctor/type-based-folder

Type-based folder · default severity warning

Source lives in a components/ or services/ folder instead of a feature folder.

angular-doctor/unused-export

Unused export · default severity warning

An exported class, function, or const is never used.