Airbnb's JavaScript style guide and the ESLint configs that enforce it
open sourceMITfree
The Airbnb JavaScript Style Guide is Airbnb's set of rules for writing JavaScript, covering types, references, objects, arrays, destructuring, strings, functions, arrow functions, classes, modules and more, with an example of good and bad code for each rule. Its rules are enforced by two ESLint shareable configs: eslint-config-airbnb, which includes the React and JSX rules from eslint-plugin-react, and eslint-config-airbnb-base without them. The guide assumes Babel and installed polyfills. Separate guides cover React, CSS-in-JavaScript, CSS and Sass, and Ruby.
Problems it solves
- agree on one JavaScript code style for my team without writing our own rulebook
- make ESLint enforce a widely used JavaScript style in my React project
- look up how a style guide says to write arrow functions or destructuring in JavaScript
Features
- a written style guide with good and bad examples for each rule
- eslint-config-airbnb with React, JSX and accessibility rules
- eslint-config-airbnb-base for projects without React
- companion guides for React, CSS-in-JavaScript, CSS and Sass, and Ruby
Limitations
Alternatives
The same job
These do what Airbnb JavaScript Style Guide does.
- ESLint Find and fix problems in your JavaScript code.
- eslint-plugin-unicorn More than 300 powerful ESLint rules
- typescript-eslint The tooling that lets ESLint and Prettier lint and read TypeScript
- eslint-plugin-react React-specific linting rules for ESLint
- eslint-config-prettier Turns off ESLint rules that conflict with Prettier
- XO Zero-config JavaScript and TypeScript linter built on ESLint
