How to Write Code Without Having to Read It
Engineers can safely change unfamiliar code with minimal reading by letting the compiler, linter and unit tests guide them: locate the entrypoint via user-visible strings (or git bisect for regressions), make the breaking change at the leaf component, then climb the callstack following build errors and sweep back down via lint errors, exhaustive switches and test failures. To make code easier for the next "non-reader," replace comments with enforced checks, wrap primitives in custom types, merge dependent arguments into tagged unions, nested objects or enums, and split decision logic into pure functions so unit tests stay simple. Examples use React Native and TypeScript but the approach generalizes to any typed, tested codebase.
Related posts
- Migrating a Large Flow Monorepo to TypeScript
Yelp Engineering mediumAdeptYelp migrated 1.4 million lines of Flow-typed JavaScript in a Lerna monorepo to TypeScript over three and a half years, converting one package at a time without ever bulk-disabling typechecking. Packages were converted bottom-up with flowts (later Stripe's flow-to-typescript-codemod), and flowgen turned the generated .d.ts files back into Flow headers so unconverted Flow code still typechecked against them. A dependency-graph importance score, Graphviz visualizations, auto-filed Jira tickets and quarterly deadlines kept the long tail moving. The result was 96.44% type coverage versus 83.15% under Flow, about 6,000 @ts-expect-error directives, and 82% of surveyed engineers reporting higher productivity. Early-2023 LLMs and cron-driven auto-conversion did not prove reliable enough to use.
- Balancing Old Tricks with New Feats: AI-Powered Conversion From Enzyme to React Testing Library at Slack
Slack Engineering mediumAdeptSlack converted over 15,000 Enzyme tests to React Testing Library ahead of its React 18 upgrade by combining AST codemods with an LLM (Claude 2.1). AST transformations alone converted about 45% of code. The LLM alone fluctuated between 40-60%. A hybrid pipeline reached about 80% on evaluated files. It fed the LLM the original test, a partially converted codemod output with in-code instructions, and the actual rendered DOM captured per test case via overridden Enzyme mount/shallow methods. A structured prompt with explicit required and optional tasks constrained hallucinations and improved results by 20-30% over the out-of-the-box LLM.
- Bun v1.4.3
Bun mediumAdept
Bun v1.4.3 adds `bun check`, a TypeScript type checker ported from typescript-go that passes all 51,210 of TypeScript 7.0.2's conformance tests and runs 3x to 6.4x faster than tsc 7 with 2.2x to 4.9x less memory. It only type checks, with no emit and no language server. Correctness was validated by diffing against tsc on 72 deliberately misconfigured open-source repos (1 mismatch in 1,103 configs), plus fuzzers and mutation testing. `--check` flags gate `bun run`, `bun test` and `bun build` on type errors. Runtime changes include 67–89% less idle CPU, `Bun.FetchSession` for per-group TLS, proxy and connection pools, better proxy env handling, experimental `Bun.ModuleGraph`, enforcement of `--disallow-code-generation-from-strings`, and up to 2.7x faster large `node:http` responses.
- From Ruby to Node: Overhauling Shopify’s CLI for a Better Developer Experience
Shopify Engineering mediumAdeptShopify rewrote its CLI from Ruby to TypeScript on Node to reduce system requirements, unify the Theme, App and Hydrogen workflows, and stay easy for internal teams to contribute to. Go and Rust were rejected despite their static binaries because few Shopify engineers know them. Node won over Ruby because its module system lets multiple versions of a transitive package coexist, which supports modular plugins. The new architecture rests on a shared @shopify/cli-kit package, custom ESLint rules, cross-OS CI testing, a monorepo, and a functional, MVC-like split of models, commands and services. It also uses Vitest unit tests, Cucumber E2E tests, and oclif plugins with hooks for dependency inversion.
- Why We Ripped Twin out of 400+ Components
Railway mediumAdeptRailway replaced twin.macro with vanilla Tailwind across 400+ React components, which removed the last dependency on Babel and let the monorepo move fully to SWC. Dev cold starts dropped from ~35s to ~1.5s, a full build from 220s to 42s, and CI from 4-6 to 2-4 minutes. The migration took ~30 PRs with a codemod and custom helpers. Nested selectors moved to Tailwind-processed CSS files, theme() calls became CSS variables, and Twin's inline-style precedence and automatic merging were handled by migrating pages first and core components last, using `!` overrides and tailwind-merge.