kcmr / vsce-remove-unused-imports

VS Code extension to remove unused ES6 imports inside JavaScript and TypeScript files
https://marketplace.visualstudio.com/items?itemName=kuscamara.remove-unused-imports
MIT License
17 stars 5 forks source link

Extension removes some Angular imports #20

Closed geksonES closed 5 months ago

geksonES commented 2 years ago

It removes Inject and MAT_DIALOG_DATA that goes into constructor


import { Component, Inject } from '@angular/core';
import { MAT_DIALOG_DATA } from '@angular/material/dialog';

@Component({
  template: '',
  styles: ['']
})
export class SomeComponent {
  constructor(
    @Inject(MAT_DIALOG_DATA)
    public dialogData
  ) { }
}
ghost commented 1 year ago

It's also happening to me

vturbin commented 1 year ago

Yes I noticed too when imports are in the constructor, such as @Inject or forwardRef, imports are not recognized and removed for some reason. Happens to me as well. Hope it can be solved soon public constructor( private notificationRequestService: NotificationRequestService, @Inject(forwardRef(() => TestRunService)) )

In combination to that I have es-lint that organizes all imports. Maybe these two things don't get along.

NurimOnsemiro commented 1 year ago

It happens to me too. I'm using the tsyringe module, and despite using @inject() in the constructor parameter, the imported module is automatically deleted the moment I save. I look forward to seeing this issue resolved.

rschuster84 commented 1 year ago

This is what happens with all these:

I don't think the list is complete though.

kcmr commented 5 months ago

:tada: This issue has been resolved in version 1.2.4 :tada:

The release is available on:

Your semantic-release bot :package::rocket: