Dead Code Shouldn’t Exist! How We Removed 28k Lines of Code, One Knip at a Time -Dominik Dorfmeister
summary
Knip scans project files and entry points to build a usage graph and reports unused files, exports and deps; Sentry runs it in CI and production mode to ignore test-only usage and finds leftovers that let the team drop deps like react-sparklines. Over ~6 weeks Knip enables about 28k lines removed (~3% of frontend TS) via many small PRs; workflow changes include a pre-push hook and editor language-server integration, while dynamic imports and webpack require.context need careful whitelisting or extra entries.
AI-written summary · about
chapters (13)
- 0:00Introduction and speaker intro
- 1:45Sentry design engineering role
- 3:13Problem with unused code
- 5:42Why dead code persists
- 7:08TypeScript limitations on dead code
- 9:13Introducing Knip tool
- 12:27Live demo with Knip
- 15:36Results of code cleanup
- 18:04Production mode and tests
- 20:31Challenges and workarounds
- 25:05Technical limitations
- 27:11Statistics and impact
- 28:04Closing and call to action
