-
Notifications
You must be signed in to change notification settings - Fork 16
Description
Hello and thank you for your work.
I was wondering if you're interested in making Code Checks track how much dead code is introduced by a PR.
The problem
When making changes to a codebase, it's common to leave code that is exported but never used. It was useful once, but it's not anymore. Unless there are good reasons to leave it in the project, it should be deleted and restored from Git history if need be.
Solutions
There are tools capable of spotting such scenarios:
- @dsherret's
no-unused-exports - https://github.com/plantain-00/no-unused-export
- https://github.com/nadeesha/ts-prune
- https://github.com/pzavolinsky/ts-unused-exports
The problem with some of these tools is that they find too many false positives or they don't provide an escape hatch to mark something as not used now, but let's leave it there. For this reason, using them to prune dead code in a precommit/prepush task may be too aggressive.
I believe there is a use case for them though. If a CI check detected the amount of dead code has increased (and presented the Δ), then this information alone is already useful. I'm not sure if the build should fail or not, but merely being presented with such a warning could help keep our codebases cleaner.
Please let me know what you think, and thanks again for your wonderful tool.