javascript
JavaScript Style Guide
A widely-adopted style guide for writing consistent, readable JavaScript code. Covers naming, formatting, and best practices with examples and ESLint rules.
This repository is the Airbnb JavaScript Style Guide, which the README itself calls a mostly reasonable approach to JavaScript. In plain terms, it is a long, opinionated document telling JavaScript developers how to write their code so that everyone on a team writes it the same way. It is not a library you install; it is a set of rules and short before-and-after examples you read and apply when you write or review code.
The guide is organized as a big table of contents covering Types, References, Objects, Arrays, Destructuring, Strings, Functions, Arrow Functions, Classes and Constructors, Modules, Iterators and Generators, Properties, Variables, Hoisting, Comparison Operators, Blocks, Control Statements, Comments, Whitespace, Commas, Semicolons, Type Casting, Naming Conventions, Accessors, Events, jQuery, ES5 Compatibility, ES6+ styles, Standard Library, Testing, Performance, and Resources. Each rule shows a bad and a good example with brief reasoning, and often links to a corresponding ESLint rule that automatically enforces it; the README notes the npm packages eslint-config-airbnb and eslint-config-airbnb-base built on these rules. A note at the top assumes you are using Babel, with babel-preset-airbnb or equivalent, and shims like airbnb-browser-shims. Sister style guides for React, CSS-in-JavaScript, CSS and Sass, and Ruby are linked from this one.
You would actually use it when starting a new JavaScript project that needs consistent style, when joining a team that already follows it, or as a teaching reference for modern JavaScript habits. The tech stack is JavaScript itself, with ESLint and Babel as the main companion tools mentioned by the README.
Where it fits
- Set up a consistent code style for your team by adopting Airbnb's conventions and ESLint config.
- Enforce JavaScript best practices automatically in CI/CD pipelines using eslint-config-airbnb.
- Learn modern JavaScript patterns and why certain approaches are preferred over others.
- Reference specific rules when code reviewing to explain why a change improves readability or maintainability.