PhpStorm 2024.1 Help

Code Inspections in Angular

This topic lists all PhpStorm code inspections available in Angular.

You can toggle specific inspections or change their severity level on the Editor | Inspections page of settings  Ctrl+Alt+S.

Inspection

Description

Default Severity

Ambiguous component tag

Reports a component that is matched on an embedded template element <ng-template> or multiple components matched on any other element.

Error Error

Angular CLI add dependency

Suggests using the ng add command to install the dependency.

ng add will use the package manager to download it and invoke a schematic which can update your project with configuration changes, add additional dependencies (e.g. polyfills), or scaffold package-specific initialization code.

Warning Warning

Content inside <ng-content> tag

Reports a text or tag occurrence inside a <ng-content> tag used for content projection.

Error Error

Inaccessible component member in AOT mode

Reports accessing a private or protected member of a component from the component's template. Such usages result in AOT compilation failure.

Warning Warning

Incorrect component template definition

Reports a component that doesn’t have an associated template or uses both template and templateUrl properties.

Error Error

Insecure binding to event

Reports a binding to an event property or attribute, for example, [onclick] or [attr.onclick] instead of (click).

Warning Warning

Invalid animation trigger assignment

Reports an invalid assignment of an animation trigger. To attach an animation to an element, use [@triggerName]="expression" or an attribute without a value @triggerName.

Error Error

Invalid entry component

Reports an invalid Angular component specified in the module’s bootstrap or entryComponents property.

Error Error

Invalid i18n attribute

Reports a problem with a i18n-* attribute.

Warning Warning

Invalid imported or declared symbol

Reports any symbol that is declared, imported or exported by an Angular module that is not a module, component, directive, or pipe or can’t be used in the context of the property.

Error Error

Issues with ngSrc usage in img tags

Reports issues related to usage of ngSrc (NgOptimizedDirective) on img tags.

Following issues are reported:

  • img tags, which use src instead of ngSrc

  • lack of width and height, or fill attributes when ngSrc is used

  • width or height, and fill attributes being present on the same element when ngSrc is used

Weak Warning Weak warning

Missing event handler

Reports a missing event handler statement for an event binding.

Error Error

Missing or invalid component, directive or pipe declaration in a module

Reports a non-standalone Angular component, directive, or pipe that is not declared in any module or is declared in multiple modules.

Error Error

Missing or invalid selector

Reports an invalid selector property of a component or directive.

Error Error

Multiple structural directives on one element

Reports multiple structural directives (*ngIf, *ngFor, etc.) on one element.

Error Error

Recursive import or export of Angular module

Reports a cyclic dependency between Angular modules.

Error Error

Unbound or ambiguous template reference variable

Reports a template reference variable that is not assigned to a directive when using exportAs or is assigned to multiple directives.

Error Error

Undefined binding

Reports an undefined property, event, or structural directive bindings on elements.

Error Error

Undefined export from Angular module

Reports an export of an undeclared or unimported component, directive, or pipes from an Angular module.

Error Error

Undefined tag

Reports a tag defined by a component or directive out of the current scope.

Error Error

Last modified: 11 February 2024