eslint-config-airbnb, eslint-config-standard, and eslint-config-xo are shared configuration packages for ESLint that enforce specific coding styles and best practices. They save teams from writing hundreds of rules manually by providing a ready-made setup. eslint-config-airbnb is known for strictness and React support. eslint-config-standard focuses on simplicity and no configuration files. eslint-config-xo offers a modern, sensible default setup often used with the XO CLI tool.
When setting up linting for a JavaScript project, writing hundreds of rules from scratch is rarely efficient. Shared configs like eslint-config-airbnb, eslint-config-standard, and eslint-config-xo provide pre-built rule sets that enforce style and catch errors. Each takes a different approach to strictness, setup, and philosophy. Let's compare how they handle real-world engineering needs.
eslint-config-airbnb requires installing many peer dependencies to work correctly.
# airbnb: Install core + peers
npm install -D eslint eslint-config-airbnb eslint-plugin-react eslint-plugin-react-hooks eslint-plugin-jsx-a11y
eslint-config-standard aims for zero configuration files.
standard CLI which hides the config file entirely.# standard: Minimal install
npm install -D eslint eslint-config-standard eslint-plugin-promise eslint-plugin-n eslint-plugin-import
eslint-config-xo keeps dependencies lighter than Airbnb.
xo CLI tool which bundles this config.# xo: Moderate install
npm install -D eslint eslint-config-xo
eslint-config-airbnb is extremely strict out of the box.
// .eslintrc.js for airbnb
module.exports = {
extends: ['airbnb'],
rules: {
// Often need to relax rules for practical use
'no-console': 'warn',
'react/prop-types': 'off'
}
};
eslint-config-standard enforces a specific style opinion.
// .eslintrc.js for standard
module.exports = {
extends: ['standard'],
rules: {
// Hard to change core style opinions
'semi': ['error', 'never'],
'quotes': ['error', 'single']
}
};
eslint-config-xo balances strictness with modern syntax.
// .eslintrc.js for xo
module.exports = {
extends: ['xo'],
rules: {
// Easier to override specific preferences
'semicolon': ['error', 'always'],
'space-before-function-paren': 'error'
}
};
eslint-config-airbnb has first-class React support built in.
// airbnb: React rules active by default
// This triggers an error if hooks are used incorrectly
function Component() {
const [val, setVal] = useState(); // Error: missing dependency array
}
eslint-config-standard treats React as an add-on.
eslint-config-standard-react to get JSX support.// standard: Requires extra config for React
module.exports = {
extends: ['standard', 'standard-react']
};
eslint-config-xo supports React via a separate preset.
xo-react to get JSX rules.// xo: React preset available
module.exports = {
extends: ['xo', 'xo-react']
};
eslint-config-airbnb allows overrides but fights you on style.
// airbnb: Overriding strict rules
module.exports = {
extends: ['airbnb'],
rules: {
'max-len': ['error', { code: 120 }] // Relax line length
}
};
eslint-config-standard is harder to tweak on style.
// standard: Overriding style (goes against grain)
module.exports = {
extends: ['standard'],
rules: {
'semi': ['error', 'always'] // Conflicts with core philosophy
}
};
eslint-config-xo is designed to be extended easily.
// xo: Clean overrides
module.exports = {
extends: ['xo'],
rules: {
'no-unused-vars': 'warn' // Adjust severity easily
}
};
| Feature | eslint-config-airbnb | eslint-config-standard | eslint-config-xo |
|---|---|---|---|
| Setup Effort | π High (many peers) | π¦ Low (zero config) | π Medium (simple) |
| Strictness | π Very High | π High (Style focused) | βοΈ Moderate |
| React Support | β Built-in | β Add-on required | β Add-on required |
| Semicolons | β Required | β Forbidden | β Required |
| Best For | Enterprise React Apps | Quick Scripts / OSS | Modern Libraries |
eslint-config-airbnb is the heavy-duty option ποΈ. It brings everything you need for a large React codebase but requires maintenance of peer dependencies. Use this when consistency matters more than setup speed.
eslint-config-standard is the opinionated shortcut β‘. It removes decision fatigue by enforcing a specific look (no semicolons). Use this for small teams or projects where you want to stop talking about style and start coding.
eslint-config-xo is the modern balanced choice βοΈ. It provides safety and cleanliness without forcing extreme style rules. Use this for libraries or teams that want solid defaults with room to breathe.
Final Thought: All three tools solve the same problem β keeping code clean β but they differ in how much control they take away from you. Pick the one that matches your team's tolerance for rules.
Choose eslint-config-airbnb if you work on large React teams that need strict consistency and accessibility rules. It requires more setup because of many peer dependencies, but it prevents common bugs in production. This is the best fit for enterprise applications where code uniformity is critical.
Choose eslint-config-standard if you want to start quickly without managing configuration files. It enforces a semicolon-free style automatically and works well for small teams or open-source projects. Avoid this if your team strongly prefers semicolons or needs heavy customization.
Choose eslint-config-xo if you want modern JavaScript defaults without extreme strictness. It works well for libraries and apps that use TypeScript or modern ES features. This is ideal for developers who want a clean setup without the heavy weight of the Airbnb config.
This package provides Airbnb's .eslintrc as an extensible shared config.
We export three ESLint configurations for your usage.
Our default export contains most of our ESLint rules, including ECMAScript 6+ and React. It requires eslint, eslint-plugin-import, eslint-plugin-react, eslint-plugin-react-hooks, and eslint-plugin-jsx-a11y. Note that it does not enable our React Hooks rules. To enable those, see the eslint-config-airbnb/hooks section.
If you don't need React, see eslint-config-airbnb-base.
npm info "eslint-config-airbnb@latest" peerDependencies
If using npm 5+, use this shortcut
npx install-peerdeps --dev eslint-config-airbnb
If using yarn, you can also use the shortcut described above if you have npm 5+ installed on your machine, as the command will detect that you are using yarn and will act accordingly.
Otherwise, run npm info "eslint-config-airbnb@latest" peerDependencies to list the peer dependencies and versions, then run yarn add --dev <dependency>@<version> for each listed peer dependency.
If using npm < 5, Linux/OSX users can run
(
export PKG=eslint-config-airbnb;
npm info "$PKG@latest" peerDependencies --json | command sed 's/[\{\},]//g ; s/: /@/g' | xargs npm install --save-dev "$PKG@latest"
)
Which produces and runs a command like:
npm install --save-dev eslint-config-airbnb eslint@^#.#.# eslint-plugin-jsx-a11y@^#.#.# eslint-plugin-import@^#.#.# eslint-plugin-react@^#.#.# eslint-plugin-react-hooks@^#.#.#
If using npm < 5, Windows users can either install all the peer dependencies manually, or use the install-peerdeps cli tool.
npm install -g install-peerdeps
install-peerdeps --dev eslint-config-airbnb
The cli will produce and run a command like:
npm install --save-dev eslint-config-airbnb eslint@^#.#.# eslint-plugin-jsx-a11y@^#.#.# eslint-plugin-import@^#.#.# eslint-plugin-react@^#.#.# eslint-plugin-react-hooks@^#.#.#
"extends": "airbnb" to your .eslintrcThis entry point enables the linting rules for React hooks (requires v16.8+). To use, add "extends": ["airbnb", "airbnb/hooks"] to your .eslintrc.
This entry point only errors on whitespace rules and sets all other rules to warnings. View the list of whitespace rules here.
This entry point is deprecated. See eslint-config-airbnb-base.
This entry point is deprecated. See eslint-config-airbnb-base.
See Airbnb's JavaScript styleguide and the ESlint config docs for more information.
Consider adding test cases if you're making complicated rules changes, like anything involving regexes. Perhaps in a distant future, we could use literate programming to structure our README as test cases for our .eslintrc?
You can run tests with npm test.
You can make sure this module lints with itself using npm run lint.