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.
Comments