# eslint-config-xo

> ESLint shareable config for XO

Latest version **2.0.0** (published 2026-08-30) · MIT license · 0 weekly downloads

## Install

```sh
npm install eslint-config-xo
pnpm add eslint-config-xo
yarn add eslint-config-xo
bun add eslint-config-xo
```

## Health

**Score 70/100 (B)** — status: active.

Positive: has types; esm support; no vulnerabilities; recently updated; high maintenance score; high quality score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 2.0.0 |
| Published | 2026-08-30 |
| First published | 2015-08-01 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM |
| Node | >=22 |
| Dependencies | 21 |
| Unpacked size | 102.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 284 |
| Author | Sindre Sorhus |
| Maintainers | sindresorhus |
| Keywords | eslintconfig, xo, xoxo, hugs, kisses, happy, happiness, code, quality, style, lint, linter, jscs, jshint, jslint, eslint, validate, code style, standard, strict, check, checker, verify, enforce, hint, simple |

## Links

- npm: https://www.npmjs.com/package/eslint-config-xo
- Repository: https://github.com/xojs/eslint-config-xo
- Homepage: https://github.com/xojs/eslint-config-xo#readme
- Issues: https://github.com/xojs/eslint-config-xo/issues
- Funding: https://github.com/sponsors/sindresorhus
- npm.io page: https://npm.io/package/eslint-config-xo

## Dependencies (21)

- [globals](https://npm.io/package/globals.md) ^17.11.0
- [@eslint/css](https://npm.io/package/@eslint/css.md) ^1.4.0
- [@eslint/json](https://npm.io/package/@eslint/json.md) ^2.0.1
- [@eslint/compat](https://npm.io/package/@eslint/compat.md) ^2.1.0
- [eslint-plugin-n](https://npm.io/package/eslint-plugin-n.md) ^18.3.0
- [@eslint/markdown](https://npm.io/package/@eslint/markdown.md) ^8.0.3
- [eslint-node-test](https://npm.io/package/eslint-node-test.md) ^0.4.0
- [eslint-plugin-ava](https://npm.io/package/eslint-plugin-ava.md) ^17.0.1
- [typescript-eslint](https://npm.io/package/typescript-eslint.md) ^8.68.0
- [eslint-package-json](https://npm.io/package/eslint-package-json.md) ^0.3.0
- [eslint-plugin-jsdoc](https://npm.io/package/eslint-plugin-jsdoc.md) ^64.2.1
- [eslint-plugin-regexp](https://npm.io/package/eslint-plugin-regexp.md) ^3.2.0
- [eslint-plugin-unicorn](https://npm.io/package/eslint-plugin-unicorn.md) ^74.0.0
- [eslint-config-prettier](https://npm.io/package/eslint-config-prettier.md) ^10.1.8
- [eslint-plugin-import-x](https://npm.io/package/eslint-plugin-import-x.md) ^4.17.1
- [eslint-plugin-prettier](https://npm.io/package/eslint-plugin-prettier.md) ^5.5.6
- [@stylistic/eslint-plugin](https://npm.io/package/@stylistic/eslint-plugin.md) ^5.10.0
- [confusing-browser-globals](https://npm.io/package/confusing-browser-globals.md) ^1.0.11
- [@html-eslint/eslint-plugin](https://npm.io/package/@html-eslint/eslint-plugin.md) ^0.65.0
- [eslint-import-resolver-typescript](https://npm.io/package/eslint-import-resolver-typescript.md) ^4.4.5
- [@eslint-community/eslint-plugin-eslint-comments](https://npm.io/package/@eslint-community/eslint-plugin-eslint-comments.md) ^4.7.2

## Alternatives

- [eslint-plugin-sonarjs](https://npm.io/package/eslint-plugin-sonarjs.md) — 2.9M weekly downloads
- [eslint-config-expo](https://npm.io/package/eslint-config-expo.md) — 1.5M weekly downloads
- [@matter/protocol](https://npm.io/package/@matter/protocol.md) — 63.5K weekly downloads
- [@eventcatalog/linter](https://npm.io/package/@eventcatalog/linter.md) — 24.8K weekly downloads
- [@inrupt/eslint-config-base](https://npm.io/package/@inrupt/eslint-config-base.md) — 4.5K weekly downloads

## Recent versions

- 2.0.0 (latest) — 2026-08-30
- 1.0.0 — 2026-08-04
- 0.58.1 — 2026-07-15
- 0.58.0 — 2026-07-14
- 0.57.0 — 2026-07-06
- 0.56.0 — 2026-07-01
- 0.55.0 — 2026-06-24
- 0.54.1 — 2026-06-22
- 0.54.0 — 2026-06-22
- 0.53.2 — 2026-06-17
- 0.53.1 — 2026-06-16
- 0.53.0 — 2026-06-16
- 0.52.0 — 2026-05-15
- 0.51.0 — 2026-03-24
- 0.50.0 — 2026-02-07
- … 74 more at https://npm.io/package/eslint-config-xo/versions

## README

# eslint-config-xo

> ESLint [shareable config](https://eslint.org/docs/developer-guide/shareable-configs.html) for [XO](https://github.com/xojs/xo) with support for JavaScript, TypeScript, HTML, and Markdown

This is for advanced users. [You probably want to use XO directly.](#use-the-xo-cli-instead)

**Use the [XO issue tracker](https://github.com/xojs/xo/issues) instead of this one.**

## Install

```sh
npm install --save-dev eslint-config-xo
```

## Usage

```js
// eslint.config.js
import eslintConfigXo from 'eslint-config-xo';
import {defineConfig} from 'eslint/config';

export default defineConfig([
	...eslintConfigXo(),
]);
```

### Options

#### browser

Type: `boolean`\
Default: `false`

Use browser globals instead of Node.js globals.

```js
export default defineConfig([
	...eslintConfigXo({browser: true}),
]);
```

#### space

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.

```js
export default defineConfig([
	...eslintConfigXo({space: true}),
]);
```

#### semicolon

Type: `boolean`\
Default: `true`

Use semicolons at the end of statements. Set to `false` to enforce no semicolons.

```js
export default defineConfig([
	...eslintConfigXo({semicolon: false}),
]);
```

#### prettier

Type: `boolean | 'compat'`\
Default: `false`

Integrate [Prettier](https://prettier.io).

- `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).

```js
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.

#### gitignore

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.

```js
export default defineConfig([
	...eslintConfigXo({gitignore: import.meta.url}),
]);
```

> [!NOTE]
> This is not needed when using the [XO CLI](https://github.com/xojs/xo), which already respects `.gitignore`.

## TypeScript

TypeScript is supported out of the box. If [`typescript`](https://github.com/microsoft/TypeScript) is installed, TypeScript rules are automatically enabled. For JavaScript-only projects, `typescript` is not required.

## HTML

HTML files (`*.html`) are linted automatically using [`@html-eslint/eslint-plugin`](https://github.com/yeonjuan/html-eslint), covering best practices, accessibility, SEO, and style.

## Markdown

Markdown files (`*.md`) are linted automatically using [`@eslint/markdown`](https://github.com/eslint/markdown), covering link/image correctness, heading structure, and more.

## Custom rules

### xo/import-specifier-newline

When an import spans multiple lines, each specifier must be on its own line. Autofixable.

```js
// 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';
```

## Included plugins

- [`eslint-plugin-unicorn`](https://github.com/sindresorhus/eslint-plugin-unicorn)
- [`eslint-node-test`](https://github.com/sindresorhus/eslint-node-test)
- [`eslint-package-json`](https://github.com/sindresorhus/eslint-package-json)
- [`eslint-plugin-ava`](https://github.com/avajs/eslint-plugin-ava)
- [`eslint-plugin-import-x`](https://github.com/un-ts/eslint-plugin-import-x)
- [`eslint-plugin-n`](https://github.com/eslint-community/eslint-plugin-n)
- [`@eslint-community/eslint-plugin-eslint-comments`](https://github.com/eslint-community/eslint-plugin-eslint-comments)
- [`@stylistic/eslint-plugin`](https://github.com/eslint-stylistic/eslint-stylistic)
- [`typescript-eslint`](https://github.com/typescript-eslint/typescript-eslint)
- [`@html-eslint/eslint-plugin`](https://github.com/yeonjuan/html-eslint)
- [`@eslint/markdown`](https://github.com/eslint/markdown)
- [`eslint-plugin-regexp`](https://github.com/ota-meshi/eslint-plugin-regexp)
- [`eslint-plugin-jsdoc`](https://github.com/gajus/eslint-plugin-jsdoc)
- [`eslint-plugin-prettier`](https://github.com/prettier/eslint-plugin-prettier) *(only when the [`prettier`](#prettier) option is enabled)*

## Use the XO CLI instead

XO is an ESLint wrapper with great defaults.

Here are some reason why you should use the [XO CLI](https://github.com/xojs/xo) instead of this config:

- XO comes bundled with this config.
- [Beautiful output.](https://github.com/sindresorhus/eslint-formatter-pretty)
- No need to specify file paths to lint. It will lint all JS files except [commonly ignored paths](https://github.com/xojs/xo#ignores).
- Super simple to add XO to a project with [`$ npm init xo`](https://github.com/xojs/create-xo).
- Config/rule overrides per files/globs.
- [Prettier](https://prettier.io) integration.
- [React](https://github.com/xojs/eslint-config-xo-react) support.
- Can open all files with errors at the correct line in your editor. *(See the `--open` flag)*
- The [editor plugins](https://github.com/xojs/xo#editor-plugins) are IMHO better than the ESLint ones. *(Subjective)*

tl;dr You miss out on a lot by just using this config.

## Related

- [eslint-config-xo-react](https://github.com/xojs/eslint-config-xo-react) - ESLint shareable config for React to be used with this config

---
_Source: https://npm.io/package/eslint-config-xo · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
