Birth of Prettier
4 hours ago
- #developer-tools
- #code-formatting
- #open-source
- Prettier was created to solve the 'Space vs Tabs Holy War' by automating code formatting.
- The project started from the author's college experience with strict formatting rules and later frustrations at Facebook with inconsistent styles.
- Early solutions like lint fixers and gofmt were explored, but none fully solved the problem until Prettier.
- Prettier's development was accelerated by friendly competition and the use of Jest's snapshot testing for efficient testing.
- The algorithm behind Prettier is based on Philip Wadler's paper, using a simple set of commands to format code.
- Prettier's success lies in its ability to enforce consistent formatting without requiring manual intervention, ending debates over style preferences.
- The project faced challenges with comments, chained methods, and object literals, requiring special handling.
- Prettier's rollout at Facebook involved strategic integrations and incentives to ensure widespread adoption.
- Maintaining Prettier has been challenging due to funding issues, despite its critical role in the JavaScript ecosystem.
- Prettier's impact is significant, with widespread adoption across multiple languages and communities.