How do i remove un-used imports from all my files in Visual Studio Code, my warning console looks like this
I have tried useing shift+alt+o
but that only removes imports from the current file
How do i remove un-used imports from all my files in Visual Studio Code, my warning console looks like this
I have tried useing shift+alt+o
but that only removes imports from the current file
There is an eslint plugin for that. It works fine with me.
It's called eslint-plugin-unused-imports.
In the file for eslint configuration:
"plugins": ["unused-imports"],
"rules": {
"no-unused-vars": "off", // or "@typescript-eslint/no-unused-vars": "off",
"unused-imports/no-unused-imports": "error",
"unused-imports/no-unused-vars": [
"warn",
{ "vars": "all", "varsIgnorePattern": "^_", "args": "after-used", "argsIgnorePattern": "^_" }
]
}
Then, on your vscode config:
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
},
I hope it helps. 😁
© 2022 - 2024 — McMap. All rights reserved.
shift+alt+o
only removes the unused imports from the Current file – Pachston