Extended Diagnostics

Unused Standalone Imports

This diagnostic detects cases where the imports array of a @Component contains symbols that aren't used within the template.

      
@Component({  imports: [UsedDirective, UnusedPipe]})class AwesomeCheckbox {}

What's wrong with that?

The unused imports add unnecessary noise to your code and can increase your compilation time.

What should I do instead?

Delete the unused import.

      
@Component({  imports: [UsedDirective]})class AwesomeCheckbox {}

What if I can't avoid this?

This diagnostic can be disabled by editing the project's tsconfig.json file:

      
{  "angularCompilerOptions": {    "extendedDiagnostics": {      "checks": {        "unusedStandaloneImports": "suppress"      }    }  }}

See extended diagnostic configuration for more info.