ts-prune
ts-prune copied to clipboard
[Feature] Avoid false positives
I noticed that many of the results are false or missleading
To Reproduce
please check this repo https://github.com/a7madgamal/ts-prune-bug and run npm run find-deadcode
Current result:
src/components/index.ts:4 - Button (used in module)
src/components/index.ts:4 - Dead (used in module)
src/components/dead/dead.ts:2 - SuperDead
I want to exclude or differentiate the result Button
.
It's exported twice, once from the Button file itself and again from index.ts (a very common practice, usually with * from xxx
so it's not possible to exclude something exported needlessly through this star)
Although the export from index.ts is useless it's still not dead-code because it's being imported from button.ts directly
Expected behavior The expected behaviour can be one of 2 options IMO: 1 - indicate this case in the results like this:
src/components/index.ts:4 - Button (⚠️ export here not needed, but used through other exports)
src/components/index.ts:4 - Dead (⚠️ export here not needed, no other exports detected)
src/components/dead/dead.ts:2 - SuperDead (🔥 kill it with fire)
2- support an option to show only completely unused exports
Optional: reference to the test project https://github.com/a7madgamal/ts-prune-bug