unplugin-auto-import icon indicating copy to clipboard operation
unplugin-auto-import copied to clipboard

Remove unused imports

Open otomad opened this issue 2 years ago • 1 comments

Clear and concise description of the problem

The issue #341 expect do not remove unused imports, however is it possible to remove the unused imports?

If I modified the imports configs, the auto-imports.d.ts will remains existing imports, unless directly remove the auto-imports.d.ts file then it will generate correctly.

Suggested solution

Add an option in the config, cover only without merging.

Alternative

No response

Additional context

No response

Validations

  • [X] Follow our Code of Conduct
  • [X] Read the Contributing Guide.
  • [X] Check that there isn't already an issue that request the same feature to avoid creating a duplicate.

otomad avatar Oct 23 '23 13:10 otomad

@lishaobos 请问一下 cache: false 选项为何被移除了,是否有方法可以恢复原有的覆盖而不是只增不减?

目前会出现当一个导出变量被添加进入 auto-imports.d.ts 后,如果原先的变量被改名或删除,原变量名仍然存在于 auto-imports.d.ts 中,这会导致 ts 代码中键入原变量名仍然可以自动导入且不触发警告,类型变为 any,网页实际运行时就会触发未找到变量的错误。

otomad avatar Sep 20 '24 16:09 otomad

Closed via #549

ilyaliao avatar Sep 01 '25 21:09 ilyaliao