Dead Code Shouldn’t Exist: How We Removed 28k Lines of Code, One Knip at a Time

This ad is not shown to multipass and full ticket holders
React Advanced
React Advanced 2026
October 23 - 26, 2026
London, UK & Online
Upcoming event
React Advanced 2026
React Advanced 2026
October 23 - 26, 2026. London, UK & Online
Bookmark
Rate this content
Sentry
Promoted
Code breaks, fix it faster

Crashes, slowdowns, regressions in prod. Seer by Sentry unifies traces, replays, errors, profiles to find root causes fast.

Get started

Ever wonder how much of your codebase is just… hanging around, doing nothing? At Sentry, we did too - and the answer was more than we expected. In this talk, I’ll share how we used Knip, a powerful tool for detecting unused files, exports, and dependencies, to declutter our frontend codebase. You’ll learn about the practical steps we took to safely identify and remove dead code, how we integrated Knip into our workflows, about unexpected edge-cases and what we learned along the way. Whether you're maintaining a massive monolith or just looking to tidy up, this session will give you practical strategies - and maybe a little inspiration - to start decluttering your own codebase, one Knip at a time.

This talk has been presented at JSNation 2026, check out the latest edition of this JavaScript Conference.

Dominik Dorfmeister
Dominik Dorfmeister
35 min
11 Jun, 2026

Comments

Sign in or register to post your comment.
Video Summary and Transcription
The talk focuses on how Sentry enables efficient shipping by building a design system with consistent components and setting coding constraints. TypeScript helps in understanding code impact and maintaining code hygiene. KNIP tool aids in detecting and removing unused code efficiently. Continuous code cleanup is facilitated by KNIP, enhancing code maintenance. KNIP helps in optimizing code utilization, handling challenges, and automating code review. Extending KNIP analysis, cross-file analysis with TypeScript and ESLint, false negatives in KNIB configuration, and tree shaking impact of bundlers are discussed.

1. Introduction to React Summit and Chase Nation

Short description:

The speaker introduces themselves as a software engineer named Dominik. They mention their online presence, blog, and the open-source library they maintain. The focus is on discussing KNIP and dead code elimination, highlighting the importance of enabling efficient and consistent shipping for product teams at Sentry through a design engineering approach.

I've been to this conference for the last four years, so this is my fifth time at React Summit and Chase Nation. But it's actually the first time that I'm giving a talk in person here. So I'm really happy and excited to talk to you about KNIP and dead code elimination today. My name is Dominik. I'm a software engineer from Vienna. And as you just said, you can also find me as tk.dodo online almost everywhere, mostly on Blue Sky these days. And I also write a blog at tk.dodo.eu, mostly about TypeScript and React.

And of course also about React Query or 10-Stack Query, which is the open source library I've been maintaining for over the last five years. Now, quick question. Raise your hand if you've worked with 10-Stack Query or React Query before. Oh, that is a lot of hands. That's great. Always love to see that. I'm not here to talk about 10-Stack or React Query today, though. I do have some 10-Stack stickers if you want. So you can come to me afterwards and grab those.

And there are also some more talks tomorrow about 10-Stack. But today I want to talk to you about something different because beginning of last year, I joined the design engineering team at Sentry, where we're not working directly on a specific part of the product, but instead our goal is to make ship happen. We want to enable other teams to ship efficiently. And in that sense, our team actually aims to make two things possible. We want to make it easy for product teams to ship the right things efficiently and consistently.

2. Efficient Shipping and Code Maintenance at Sentry

Short description:

The team at Sentry focuses on building a design system to enable efficient shipping by ensuring a library of consistent components with good APIs, documentation, and accessibility. They work on setting up constraints like TypeScript, linting, project structure, and documentation to improve the overall codebase. Addressing the impact of unused code, they emphasize the importance of maintaining code hygiene to prevent cognitive overload and slowdowns in development.

And at the same time, kind of guard them towards not shipping the wrong or inconsistent things and get them into that pit of success per default. And to get there, a big part of our team's job is building a design system, which is a library of consistent components with good APIs and documentation and type safety and accessibility built in. Because those components need to be easily discoverable so that product developers can compose them and ship them fast without breaking things.

And for the second point, we're actively working on constraints. So that means setting up TypeScript and linting, but also project structure and documentation and teaching and also AI skills these days play a big role in that. So in a nutshell, we try to get the overall codebase of Sentry that has kind of grown organically over the last 10 years into a good shape so that both humans and their agents can ship fast. And that means we have to touch a lot of parts of the codebase regularly.

Like, for example, my very first PR at Sentry touched over 900 files because I enabled the no implicit any compiler setting, which I was really surprised that this was not turned on, to be honest. And while I did this and some other improvements, I was sometimes wondering if I should maybe, you know, sanity check the things that I was touching or at least find out where they are used. And sometimes it turns out they weren't used at all.

So when I introduced the ESLint plugin query for checking if the React query hooks are working efficiently, I got a bunch of violations, like in this hook, and I tried to fix them. And after I battled with this for a while, I wanted to find out where it was used. And it turns out it was not used at all in the codebase. So I thought to myself, OK, that's it. No more. This is slowing me down. I'm wasting a lot of time here. I got a clean house because unused code has a real cost. It means that developers will spend time reading and trying to understand it, maybe even refactoring code that shouldn't be there in the first place.

And I think this becomes even more important in the age of AI, where generating extra code is easy, but maintaining it over time is actually hard, and every unused line of code might still consume tokens or bloat the context window of agents. And library upgrades or changing lint rules becomes more painful the more usages we have, because those tools, they don't care if code is used or not. If it exists, it has to be error-free. And it might even increase our bundle size if it's not properly tree-shaken out, for example, if we have side-effectful modules.

So all in all, I think unused code is a pain. It increases cognitive load. And that's why we should care about it. It will slow us down. So how did we end up here? Well, I like to think that engineers are generally responsible beings that like to clean up after themselves, but in truth, we have to be constantly reminded about the most basic forms of cleanup. And I think we are rightfully so driven by errors, because TypeScript gives us a lot of confidence. It takes all of those dependencies that used to be in our head, and it makes them explicit in code.

Check out more articles and videos

We constantly think of articles and videos that might spark Git people interest / skill us up or help building a stellar career

Scaling Fast – Engineering Lessons From ~15 Years of Tech Startups
React Advanced 2024React Advanced 2024
27 min
Scaling Fast – Engineering Lessons From ~15 Years of Tech Startups
Hey, we'll discuss scaling fast and engineering lessons learned in the last 15 years of tech startups. Scaling involves three things: business, team, and tech. Business scalability relies on sales and customer acquisition costs. Engineering is a tool the business uses. Scaling the team is vital as tech problems are often people problems. Team structure affects architecture and product development process. Organize teams based on purpose, not technology. Spend less time being blocked by other teams. Ship features without getting blocked. Own your own mess. Focus on product engineering partnership. Build faster using feedback cycles. Build appropriate solutions for your use case. Let go of ego and experiment with different approaches. Engineers own their own mess. Avoid work in progress. Finish the work and focus on fixing it later. Have a conversation before writing code. Scaling the tech is easier than you think. Pick an off the shelf design. Save innovation for core parts. Pick existing solutions. Focus on solving the problem. Don't waste time trying to predict future scale. Scale will surprise you. Do what works for your business. Push back on unnecessary complexity. Understand the cost of ideas. Modify the situation to fit existing design. Architecture is like a dependency graph on your code. Reduce architectural complexity by organizing code based on what it does. Use vertical models and avoid creating excessive dependencies. On the client, use vertical modules. On the back end, consider a service-oriented architecture. Start with a monolith and transition to microservices if necessary. Use folders instead of microservices when you have a small team. Use vertical models and contract or type-driven development to define clear APIs and interfaces. Avoid highly interconnected code and duplication. Focus on data structures to avoid complexity and the need for translation layers. Building translation layers can lead to slow user experience. Vertical teams aligned with vertical code allow for fast problem-solving, full control of features, and efficient data handling. Understanding the entire domain enables faster development with fewer bugs.
How I Automated Code Changes for 100 Repositories: Getting Started With Codemods
React Day Berlin 2022React Day Berlin 2022
28 min
How I Automated Code Changes for 100 Repositories: Getting Started With Codemods
This Talk discusses automating code changes for Android repositories, utilizing tools like JSCodeShift and Abstract Syntax Tree. The speaker shares a real use case example of maintaining a design system library and making changes to a component. The talk emphasizes the importance of automating repetitive tasks and using the power of abstract syntax tree for code changes. The Q&A session covers topics like source code formatting, TypeScript support, and cultural embedding of code mods. The talk concludes with insights on when automation is worth it and the limitations of code mods for monorepo changes.
Next Generation Code Architecture for Building Maintainable Node Applications
Node Congress 2023Node Congress 2023
30 min
Next Generation Code Architecture for Building Maintainable Node Applications
Today's Talk focused on code architecture, modularization, and scaling in software development. The speaker discussed the benefits of separating code by domain and using tools like NX to improve productivity and enforce modular architecture. They also highlighted the importance of automating library creation and configuration. Additionally, the Talk covered code scaling and deployment strategies, including caching and automated code migrations. The speaker emphasized the flexibility and scalability of Fastify and the advantages of using a monorepo for front-end and back-end development.
Sub Agent Context Sharing: How to Enable Effective Sub Agents for Coding
AI Coding Summit 2025AI Coding Summit 2025
15 min
Sub Agent Context Sharing: How to Enable Effective Sub Agents for Coding
Cloud Code introduced sub-agent feature for better performance. Understanding the sub-agent concept and its role. Challenges of sub-agents in direct implementation. Parent agents' limited visibility. Efficient context management with MD files for sub-agents' tasks and reports boosting Cloud Code performance. Guidelines for creating useful sub-agents with specific MCP tools. Utilizing TweakScene MCP for scene design reference and defining rules for sub-agent tasks. Setting goals, output format, and rules for sub-agents. Building a chat GPT replica with chat.cn UI and Versatile AIS. Integration with VerCell AI SDK for seamless implementation.
The Future Stack of Code Review
JSNation 2023JSNation 2023
22 min
The Future Stack of Code Review
The Talk discusses the challenges of code reviews and the need to redefine the code review process in light of changes in software development. It emphasizes the importance of collaboration, security, performance, and clean code in the new stack of code review. The Talk also highlights the benefits of automating code review comments and optimizing the code review process. Overall, the Talk aims to build a better code review process that promotes collaboration and improves the quality of software development.
Road to Zero Lint Failures: Tackling Code Quality Challenges at Scale
React Summit US 2023React Summit US 2023
11 min
Road to Zero Lint Failures: Tackling Code Quality Challenges at Scale
This Talk discusses the journey from thousands of Lint failures to zero in a codebase at Linton that is over 80 years old. The approach involved implementing rules, incentives, and tooling to address the issue. The tool called Checkup was used to visualize ESLint failures by team and lint rule, providing accountability and responsibility. The efforts resulted in cleaning up over 6,000 lint failures, with 55 contributors, and a 30% increase in perceived code quality.

Workshops on related topic

Production-Ready Apps with AI Agents
React Summit 2025React Summit 2025
102 min
Production-Ready Apps with AI Agents
Featured Workshop
Alex Shershebnev
Alex Shershebnev
Coding assistants are already changing the way we develop code, and in several years they are expected to completely change how developers interact with code and write it. In this workshop, I'll share tips and best practices on using such tools as we develop the production-ready app with Zencoder.
Bring Code Quality and Security to your CI/CD pipeline
DevOps.js Conf 2022DevOps.js Conf 2022
76 min
Bring Code Quality and Security to your CI/CD pipeline
Workshop
Elena Vilchik
Elena Vilchik
In this workshop we will go through all the aspects and stages when integrating your project into Code Quality and Security Ecosystem. We will take a simple web-application as a starting point and create a CI pipeline triggering code quality monitoring for it. We will do a full development cycle starting from coding in the IDE and opening a Pull Request and I will show you how you can control the quality at those stages. At the end of the workshop you will be ready to enable such integration for your own projects.
AI-Powered Code Review
TechLead Conf Amsterdam 2026: Adopting AI in Orgs EditionTechLead Conf Amsterdam 2026: Adopting AI in Orgs Edition
77 min
AI-Powered Code Review
Workshop
Serhii Yakovenko
Serhii Yakovenko
Every engineering organisation is experimenting with AI coding assistants, but few have built production-grade LLM integrations into their core developer infrastructure. I have such an experience, and I will share real patterns from deploying an AI-powered code review system across a 400+ person engineering organisation (~200 developers) — covering a competitive evaluation of 4 tools across 18 dimensions, building a webhook-based review architecture with slash commands and auto-review, evolving context enrichment from static rules to AI-powered document selection, managing a 4-model fallback chain on Vertex AI, and measuring impact through a feedback dashboard. Attendees will leave with a battle-tested
playbook for integrating LLMs into their own engineering workflows — not as toys but as production infrastructure.

Workshop Structure
1. The Code Review Bottleneck at Scale
2. Tool Evaluation — 4 Candidates, 18 Dimensions
3. Architecture — Webhook Server & Auto-Review
4. Context Enrichment — From Path Rules to AI- Document Selection
5. Model Strategy — Migration & Fallback Chain
6. Measuring Impact — Feedback Dashboard