Let's take this file :
const foo = require('./bar')
foo is not used anymore.
How to automatically remove this line from the file ? Is there any command for that job ?
Let's take this file :
const foo = require('./bar')
foo is not used anymore.
How to automatically remove this line from the file ? Is there any command for that job ?
If you're using VS code then go to one unused declaration then press Ctrl+.
. Or hover over it and It will a show quick fix option. Click on it then select the Delete all unused declaration
.
Or if you're using vim/nvim
with coc.vim
use the <leader>qf
shortcut to do a quick fix.
I found that this question has already been answered here Is there a way to remove unused imports and declarations