
Airbnb JavaScript Style Guide
A widely used style guide with rules and ESLint configs for writing consistent JavaScript.airbnb/javascript
- Stars
- 148k
- Forks
- 26.5k
- Licence
- MIT
- Language
- JavaScript
- Last update
- 7 months ago
- Type
- Learning resource
What it is
This is a written style guide for JavaScript, covering how to name things, format code, and use modern language features. Each rule is paired with examples of 'bad' and 'good' code and often a short explanation of why. The README also points to ESLint configs (eslint-config-airbnb and eslint-config-airbnb-base) that automatically enforce many of these rules in a project.
- Set up ESLint with the Airbnb config so a project's code is checked against the guide's rules
- Look up the recommended way to declare variables, such as preferring const over var
- Use the examples as a reference during code review to keep naming and formatting consistent
- Learn modern JavaScript conventions like object shorthand and computed property names
Great for
- Teams that want one shared JavaScript style without debating every rule
- Developers who want a documented set of modern JavaScript conventions
- Projects that already use ESLint and want a ready-made rule set
- Developers learning ES2015+ syntax who want clear examples
Not ideal for
- Projects that already follow a different established style and do not want to change, since adopting it means many edits
- Developers who need a guide for CSS, React, or Ruby specifically, since those are separate guides linked from the README
- Teams targeting environments where the README's Babel and polyfill assumptions do not hold, since the guide assumes those tools are in use
How to get it
- 1
See the README
You'll need: Node.js (required if using the ESLint configs; version not stated in the provided README)
Clone the repository
git clone https://github.com/airbnb/javascript.git - 2
Run it
- Read the Types and References sections to see the style rules and examples
- Decide whether to adopt the guide as-is or only parts of it
- To enforce the rules, install the ESLint config named in the README (eslint-config-airbnb or eslint-config-airbnb-base) following its own documentation
- Run ESLint on your code to see which rules it flags
- 3
Get the most out of it
- Use the eslint links next to each rule to find the matching ESLint rule for automatic checking
- Read the 'Why?' explanations to understand the reasoning behind a rule before overriding it
- Check the React, CSS-in-JavaScript, and CSS & Sass guides linked in the README if your project uses those technologies
Downloads
Strengths
- Widely adopted, with rules that are explained with examples
- Maps many rules to specific ESLint rules, so enforcement can be automated
- Covers a broad range of topics, from types and naming to testing and performance
Trade-offs
- It is opinionated; some rules are subjective and not every team will agree with them
- The README assumes Babel and polyfill tooling, which adds setup for projects that do not use them
- The README excerpt provided is truncated, so the full scope of later sections could not be verified here
How it compares
| Project | Stars | Type | Level | Updated | Best for |
|---|---|---|---|---|---|
| javascript (this) | 148k | Learning resource | beginner | 7 months ago | Teams that want one shared JavaScript style without debating every rule |
| prettier | 52.4k | Dev tool | beginner | 4 days ago | Teams that want one shared code style without writing their own rules |
| standard | 29.4k | Dev tool | beginner | 1.3 years ago | JavaScript projects where the team wants consistent style without debating rules |
| ruff | 50.4k | CLI | beginner | 4 days ago | Python developers who want one tool for linting and formatting |
| babel | 44.1k | Dev tool | intermediate | 4 days ago | Web developers who want to use recent JavaScript syntax while still supporting older browsers |
| core-js | 25.5k | Library | intermediate | 4 days ago | Web developers who must support older browsers or engines that lack modern JavaScript features |
Stats synced from GitHub. The assessment above was drafted with AI from the project's README on 2026-10-29 and may miss recent changes — check the README before relying on a command. MIT licence: free to use, modify and distribute, including commercially, as long as you keep the copyright notice.