javascript
JavaScript Style Guide
Airbnb's JavaScript style guide, a rulebook of coding conventions with right/wrong examples to keep team code consistent and readable.
This is a comprehensive JavaScript style guide maintained by Airbnb that lays out conventions for how to write clean, consistent JavaScript code. Think of it as a rulebook—like a style guide you might use for writing in English, but for code instead. It covers everything from how to name variables to where to put spaces and semicolons.
The guide provides specific recommendations on dozens of coding practices. For example, it suggests using const by default instead of var when declaring variables (because it prevents accidental changes), using modern syntax features like destructuring to make code shorter, and keeping lines under 100 characters for readability. Each recommendation includes examples showing the wrong way and the right way to do something, plus an explanation of why the rule matters. The guide also covers special cases like how to handle React code, older versions of JavaScript, and CSS if you're working in those areas.
The primary value is consistency. If a team or company adopts this style guide, everyone writes code the same way—similar variable naming patterns, similar formatting, similar structure. This makes it much easier for team members to read each other's code and switch between projects without being confused by different conventions. The guide is popular enough that it's been downloaded millions of times and there are tool packages (like eslint-config-airbnb) that automatically check if your code follows these rules.
Who uses this? Developers working in teams or on shared codebases where standardization matters. Startups that want a solid foundation for code quality without debating style choices. Anyone learning JavaScript who wants to understand what professional code looks like. The README itself doesn't show implementation details—it's pure guidelines and examples—so it's meant to be read by humans as a reference, not automated by tools (though the guide does reference linter configurations that can enforce many of these rules automatically).
Where it fits
- Adopt a shared style guide so a whole team writes JavaScript consistently.
- Set up eslint-config-airbnb to automatically enforce the guide's rules.
- Learn what professional, readable JavaScript code conventions look like.