ESLint shareable config for XO
284
stars
435
commits
JavaScript
primary language
Aug 28, 2026
updated
ESLint shareable config for XO with support for JavaScript, TypeScript, HTML, and Markdown
This is for advanced users. You probably want to use XO directly.
Use the XO issue tracker instead of this one.
npm install --save-dev eslint-config-xo
// eslint.config.js
import eslintConfigXo from 'eslint-config-xo';
import {defineConfig} from 'eslint/config';
export default defineConfig([
...eslintConfigXo(),
]);
Type: boolean
Default: false
Use browser globals instead of Node.js globals.
export default defineConfig([
...eslintConfigXo({browser: true}),
]);
Type: boolean | number
Default: false
Use spaces for indentation instead of tabs. Set to true for 2 spaces, or a number for a custom count.
export default defineConfig([
...eslintConfigXo({space: true}),
]);
Type: boolean
Default: true
Use semicolons at the end of statements. Set to false to enforce no semicolons.
export default defineConfig([
...eslintConfigXo({semicolon: false}),
]);
Type: boolean | 'compat'
Default: false
Integrate Prettier.
true — Run Prettier as an ESLint rule using XO's Prettier style, and disable the stylistic rules that would conflict with it. Requires prettier to be installed.'compat' — Only disable the stylistic rules that conflict with Prettier, for when you run Prettier separately (for example, from your editor or a script).export default defineConfig([
...eslintConfigXo({prettier: true}),
]);
Prettier options you set in a .prettierrc still apply for anything XO does not configure (like printWidth or plugins), but XO's own style settings take precedence.
Type: string
Ignore paths listed in your project's .gitignore file.
Pass import.meta.url so the .gitignore is resolved relative to your ESLint config file. It is a no-op if the file does not exist.
export default defineConfig([
...eslintConfigXo({gitignore: import.meta.url}),
]);
[!NOTE] This is not needed when using the XO CLI, which already respects
.gitignore.
TypeScript is supported out of the box. If typescript is installed, TypeScript rules are automatically enabled. For JavaScript-only projects, typescript is not required.
HTML files (*.html) are linted automatically using @html-eslint/eslint-plugin, covering best practices, accessibility, SEO, and style.
Markdown files (*.md) are linted automatically using @eslint/markdown, covering link/image correctness, heading structure, and more.
When an import spans multiple lines, each specifier must be on its own line. Autofixable.
// Bad
import {
foo, bar, baz,
} from 'x';
// Good
import {
foo,
bar,
baz,
} from 'x';
// Single-line imports are not affected
import {foo, bar} from 'x';
eslint-plugin-unicorneslint-node-testeslint-package-jsoneslint-plugin-avaeslint-plugin-import-xeslint-plugin-n@eslint-community/eslint-plugin-eslint-comments@stylistic/eslint-plugintypescript-eslint@html-eslint/eslint-plugin@eslint/markdowneslint-plugin-regexpeslint-plugin-jsdoceslint-plugin-prettier (only when the prettier option is enabled)XO is an ESLint wrapper with great defaults.
Here are some reason why you should use the XO CLI instead of this config:
$ npm init xo.--open flag)tl;dr You miss out on a lot by just using this config.
JavaScript
100.0%
ESLint shareable config for XO
284
stars
435
commits
JavaScript
primary language
Aug 28, 2026
updated
ESLint shareable config for XO with support for JavaScript, TypeScript, HTML, and Markdown
This is for advanced users. You probably want to use XO directly.
Use the XO issue tracker instead of this one.
npm install --save-dev eslint-config-xo
// eslint.config.js
import eslintConfigXo from 'eslint-config-xo';
import {defineConfig} from 'eslint/config';
export default defineConfig([
...eslintConfigXo(),
]);
Type: boolean
Default: false
Use browser globals instead of Node.js globals.
export default defineConfig([
...eslintConfigXo({browser: true}),
]);
Type: boolean | number
Default: false
Use spaces for indentation instead of tabs. Set to true for 2 spaces, or a number for a custom count.
export default defineConfig([
...eslintConfigXo({space: true}),
]);
Type: boolean
Default: true
Use semicolons at the end of statements. Set to false to enforce no semicolons.
export default defineConfig([
...eslintConfigXo({semicolon: false}),
]);
Type: boolean | 'compat'
Default: false
Integrate Prettier.
true — Run Prettier as an ESLint rule using XO's Prettier style, and disable the stylistic rules that would conflict with it. Requires prettier to be installed.'compat' — Only disable the stylistic rules that conflict with Prettier, for when you run Prettier separately (for example, from your editor or a script).export default defineConfig([
...eslintConfigXo({prettier: true}),
]);
Prettier options you set in a .prettierrc still apply for anything XO does not configure (like printWidth or plugins), but XO's own style settings take precedence.
Type: string
Ignore paths listed in your project's .gitignore file.
Pass import.meta.url so the .gitignore is resolved relative to your ESLint config file. It is a no-op if the file does not exist.
export default defineConfig([
...eslintConfigXo({gitignore: import.meta.url}),
]);
[!NOTE] This is not needed when using the XO CLI, which already respects
.gitignore.
TypeScript is supported out of the box. If typescript is installed, TypeScript rules are automatically enabled. For JavaScript-only projects, typescript is not required.
HTML files (*.html) are linted automatically using @html-eslint/eslint-plugin, covering best practices, accessibility, SEO, and style.
Markdown files (*.md) are linted automatically using @eslint/markdown, covering link/image correctness, heading structure, and more.
When an import spans multiple lines, each specifier must be on its own line. Autofixable.
// Bad
import {
foo, bar, baz,
} from 'x';
// Good
import {
foo,
bar,
baz,
} from 'x';
// Single-line imports are not affected
import {foo, bar} from 'x';
eslint-plugin-unicorneslint-node-testeslint-package-jsoneslint-plugin-avaeslint-plugin-import-xeslint-plugin-n@eslint-community/eslint-plugin-eslint-comments@stylistic/eslint-plugintypescript-eslint@html-eslint/eslint-plugin@eslint/markdowneslint-plugin-regexpeslint-plugin-jsdoceslint-plugin-prettier (only when the prettier option is enabled)XO is an ESLint wrapper with great defaults.
Here are some reason why you should use the XO CLI instead of this config:
$ npm init xo.--open flag)tl;dr You miss out on a lot by just using this config.
JavaScript
100.0%