Dead Code Shouldn't Exist
summary
Concrete result: running Knip across the Sentry frontend removes about 28k lines — roughly 3% of the codebase — by finding unused files, exports, and deps. The team integrates Knip into CI and an optional pre-push hook, uses production mode to ignore test-only usages, enables editor hints via the language server, and enables autofix; runtime drops from ~6s to ~4s in the large repo. The cleanup lands and keeps dead code out.
AI-written summary · about
chapters (11)
- 0:00Introduction
- 2:00Sentry’s engineering mission
- 4:30Cost of unused code
- 7:22TypeScript misses exports
- 9:49Introducing KNIP
- 13:22Live demo with KNIP
- 18:23Production and test dead code
- 21:14KNIP limitations
- 25:50Dynamic imports edge cases
- 27:58Results and impact
- 29:01Start using KNIP
related talks
38mDeleting Code Is Hard And You Should Do It
35mKill your Dead Code with Fire!
01h 22mHow to Delete Code
20mDeadcode – a Tool to Find and Fix Unused (Dead) Python Code
27mThe art of deleting code
01h 01mDoes Your Codebase Spark Joy?
45mRemoving Dead Code from a Project: A Practical Guide
16mClean code is no longer a myth
