How to delete all unused variables in a project in WebStorm or other editor?
I have a lot of unused CommonJS imports like this. I'd like to remove them from my project.
var ReactDOM = require('react-dom');
How to delete all unused variables in a project in WebStorm or other editor?
I have a lot of unused CommonJS imports like this. I'd like to remove them from my project.
var ReactDOM = require('react-dom');
You can remove all unused variable in current file using quickfix:
Alt+Enter
on unused variable, hit Right
If fixing the problem for each file individually is not an option for you, try using ESLint auto-fix per @Hitmands suggestion
You can remove all unused imports in current file using
Ctrl + Alt + O
© 2022 - 2025 — McMap. All rights reserved.
no-unused-*
you can easily using the fix command: blog.jetbrains.com/webstorm/2016/08/using-external-tools – Lefflerno-unused-vars
rule are not fixeble eslint.org/docs/rules – Cleodell