javascript

  • Object.groupBy, and the reduce I stopped writing

    A reduce with an accumulator object, written for the ninth time, replaced by a method. Object.groupBy returns an object with a null prototype, which is the detail that…

  • @starting-style, and an entry animation without JavaScript

    An element that starts hidden and animates in had needed a class added on the next frame, because there is no style to transition from. The requestAnimationFrame dance…

  • A container query that replaced a resize observer

    Thirty lines of JavaScript observing an element and toggling a class, replaced by four lines of CSS. The observer version also had a frame of the wrong layout…

  • The dependency we vendored

    A 200-line package with 41 transitive dependencies, doing one thing, and an advisory in something four levels down that we had never heard of.

  • 140 KB of JavaScript on a page with four interactions

    Four interactive blocks on a page, each shipping its own approach to the same problem. Four independent solutions to the same class of problem is what happens when…

  • Vite 5, and the Node 18 minimum

    The November release drops Node 16, which reached end of life in September, and the upgrade was mostly about the runtime rather than the tool. A major version…

  • Block hooks, and the plugin that inserts itself

    6.4 in November, and a plugin that can insert a block without editing a template. Install instructions that said “now edit your footer”.

  • The bundle we split by route, and the waterfall it created

    A 900 KB bundle, split by route, and a page that got slower. Six sequential requests before the first render.

  • A flat ESLint config, ported from one nobody understood

    A cascade of .eslintrc files with extends chains four deep, where nobody could say which rules were actually active. The flat config is a JavaScript array with explicit…

  • :has(), and the JavaScript I deleted

    Styling a parent based on its children required a class toggled by script, which meant a render, a layout and a class name in two places. Three script…