You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
The feature with the schematic to clean up unused imports duplicates the import array #59466
Which @angular/* package(s) are the source of the bug?
Don't known / other
Is this a regression?
Yes
Description
I created a new project and upgraded it to Angular 19.1.0-rc.0 to try out the new schematic to clean up unused imports. After running the command, the imports array got duplicated.
I added an unused import in app.component.ts and ran the command `ng g @angular/core:cleanup-unused-imports` and the imports array got duplicated.
**Before:**
`
import { Component } from '@angular/core';
import { RouterOutlet } from '@angular/router';
import { UnusedComponent } from './unused.component';
@Component({
selector: 'app-root',
imports: [RouterOutlet, UnusedComponent],
templateUrl: './app.component.html',
styleUrl: './app.component.css'
})
export class AppComponent {
title = 'cleanup-unused-imports';
}
`
**After:**
`
import { Component } from '@angular/core';
import { RouterOutlet } from '@angular/router';
@Component({
selector: 'app-root',
imports: [RouterOutlet][RouterOutlet],
templateUrl: './app.component.html',
styleUrl: './app.component.css'
})
export class AppComponent {
title = 'cleanup-unused-imports';
}
`
The line with imports contains two arrays of [RouterOutlet] instead of one.
Please provide the environment you discovered this bug in (run ng version)
Activity
crisbeto commentedon Jan 10, 2025
Should be fixed by #59452.
angular-automatic-lock-bot commentedon Feb 10, 2025
This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.