From 4b6ee30e749fd3c92e9ea80f341c2931956b28e4 Mon Sep 17 00:00:00 2001 From: Kristiyan Kostadinov Date: Sun, 26 Oct 2025 10:13:45 +0100 Subject: [PATCH] refactor: remove last references of CommonModule Removes the last remaining references of the `CommonModule`. All of its dependencies should be imported directly instead. --- .../cdk/tree/cdk-tree-complex/cdk-tree-complex-example.ts | 4 ++-- src/dev-app/system/system-demo.ts | 3 +-- tslint.json | 1 + 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/components-examples/cdk/tree/cdk-tree-complex/cdk-tree-complex-example.ts b/src/components-examples/cdk/tree/cdk-tree-complex/cdk-tree-complex-example.ts index 9164277e240d..8fbd4f558482 100644 --- a/src/components-examples/cdk/tree/cdk-tree-complex/cdk-tree-complex-example.ts +++ b/src/components-examples/cdk/tree/cdk-tree-complex/cdk-tree-complex-example.ts @@ -1,5 +1,5 @@ import {CdkTreeModule} from '@angular/cdk/tree'; -import {CommonModule} from '@angular/common'; +import {AsyncPipe} from '@angular/common'; import {ChangeDetectionStrategy, Component, OnInit} from '@angular/core'; import {MatButtonModule} from '@angular/material/button'; import {MatIconModule} from '@angular/material/icon'; @@ -247,7 +247,7 @@ class ComplexDataStore { selector: 'cdk-tree-complex-example', templateUrl: 'cdk-tree-complex-example.html', styleUrls: ['cdk-tree-complex-example.css'], - imports: [CdkTreeModule, MatButtonModule, MatIconModule, CommonModule, MatProgressSpinnerModule], + imports: [CdkTreeModule, MatButtonModule, MatIconModule, MatProgressSpinnerModule, AsyncPipe], changeDetection: ChangeDetectionStrategy.OnPush, }) export class CdkTreeComplexExample implements OnInit { diff --git a/src/dev-app/system/system-demo.ts b/src/dev-app/system/system-demo.ts index ba611cda5fbd..c3e0490359dd 100644 --- a/src/dev-app/system/system-demo.ts +++ b/src/dev-app/system/system-demo.ts @@ -1,4 +1,3 @@ -import {CommonModule} from '@angular/common'; import {ChangeDetectionStrategy, Component} from '@angular/core'; import {MatCardModule} from '@angular/material/card'; @@ -30,7 +29,7 @@ interface ColorGroup { selector: 'system-demo', templateUrl: 'system-demo.html', styleUrls: ['system-demo.css'], - imports: [CommonModule, MatCardModule], + imports: [MatCardModule], changeDetection: ChangeDetectionStrategy.OnPush, }) export class SystemDemo { diff --git a/tslint.json b/tslint.json index aa514c5ed925..b8c41104390a 100644 --- a/tslint.json +++ b/tslint.json @@ -40,6 +40,7 @@ {"name": ["Object", "assign"], "message": "Use the spread operator instead."}, {"name": ["*", "asObservable"], "message": "Cast to Observable type instead."}, {"name": ["*", "removeChild"], "message": "Use `remove` instead instead."}, + {"name": ["CommonModule"], "message": "Import the necessary symbols directly instead."}, {"name": ["*", "compileComponents"], "message": "`compileComponents` is not necessary."}, { "name": ["isDevMode"],