This episode features James Long, creator of Prettier, discussing the origins and impact of opinionated code formatting. He explains how Prettier addresses the "surprisingly human problem" of engineers debating code style, improving developer productivity and consistency, while also touching on the challenges of open-source maintenance and the technical complexities of building such tools.
Summarized by Podsumo
Prettier's Genesis: Created to eliminate time-wasting debates over code style, offering a deterministic, opinionated formatter that significantly boosted developer productivity by allowing rapid, unformatted code entry and instant formatting.
Beyond ESLint: Prettier's holistic approach to formatting surpasses ESLint's rule-based limitations, especially for complex JavaScript patterns like nested functions, which traditional linters struggle to express.
Open Source Realities: The project faced initial pushback from developers attached to manual formatting and continues to grapple with the financial challenges of open-source maintenance, with only ~$243,000 raised over 9+ years.
The "Completed" Tool: James Long views Prettier as largely "completed" for his personal use, not feeling the performance need for Rust rewrites (like Ox Format, Biome), but acknowledges their value for large-scale enterprise codebases and unified toolchains.
Compiler Fundamentals: Prettier functions as a JavaScript-to-JavaScript compiler, converting code to an Abstract Syntax Tree (AST), processing it through an intermediate representation, and then generating a new string, with comment handling being a particularly complex challenge.
"It just felt like such a waste of time to be having these PR reviews go back and forth about formatting it. And it was like a weirdly emotional thing that just to me just did not matter at all."
— James Long
"I think that argument has kind of been proven false to where most people use it now and the benefits of it are worth it. I think that was an attachment to the code that you wrote, that argument just wasn't correct."
— James Long
"Compilers are really hard. The biggest thing is just performance... how to trace the source information through that compiler is a really hard problem."
— James Long