lein-nsorg
lein-nsorg copied to clipboard
Static useless import removal?
Hi! Thanks for this project, it's a nice tool to keep code clean. What would it take to remove unused or duplicate imports? Could this be done statically?
Thanks for the feedback and improvement suggestions!
At least some duplicate imports would be really easy to catch when sorting, but some cases (e.g. requiring same namespace with different options) would require more work. I think would be still doable with static analysis. Thanks for the idea, I didn't even think about this 😊
I think it would be also possible to catch some unused imports statically but I don't think it possible to make it accurate with only static analysis. I have been thinking about using clojure/tools.analyzer for this but haven't started working on it yet: https://github.com/immoh/nsorg/issues/2
Aw, so sad there is no analyzer for cljs :-(
I didn't know tools.analyzer.js has been abandoned. However, it shoudn't require any knowledge about host to analyze and find unused imports so it must be possible some way.
Just release 0.2.0 with duplicate removal.
btw will you get to ClojuTRE in Helsinki this week? :-)
@piotr-yuxuan I will be there