Repolode
xojs

xojs/xo

A zero-config JavaScript/TypeScript linter that wraps ESLint with opinionated, strict defaults and a built-in code style.

Stars
7,995
Forks
309
Open issues
3
Last commit
2 months ago

What is it?

XO is a command-line linter for JavaScript and TypeScript that wraps ESLint with a set of opinionated defaults. Running it in a project lints JS, TS, and framework files, and also HTML, Markdown, JSON and CSS, without needing to list file paths or write an ESLint config. It is aimed at teams that want to stop debating code style in pull requests and let the tool enforce one consistent set of rules.

The default style uses tab indentation, semicolons, single quotes and trailing commas, and can be switched to spaces or no-semicolon style with flags. Bundled ESLint plugins such as unicorn, import-x, ava and n add further checks. Settings can be customized in an xo.config.js or xo.config.ts file, which follows ESLint's flat config format. Results are cached between runs, and `--fix` applies automatic corrections.

XO requires the project to use ES modules. Framework-specific linting for Astro, React, Svelte and Vue is added through separate ESLint plugins, and an optional Prettier mode either formats code or disables conflicting rules.

Key features

  • 01Zero-config linting of JS, TS, HTML, Markdown, JSON and CSS files.
  • 02Built-in TypeScript support and bundled ESLint plugins such as unicorn and import-x.
  • 03Auto-fix with `--fix` and opening files with errors in an editor with `--open`.
  • 04Simple style options for indentation and semicolons without touching rule config.
  • 05Optional Prettier formatting or a compat mode that turns off Prettier-conflicting rules.
  • 06Bulk suppression support through an eslint-suppressions.json file.

Use cases

  • Enforcing a consistent code style across a team without writing an ESLint config.
  • Adding a linter to a new JavaScript or TypeScript project with a single command.
  • Linting Vue, Svelte, Astro or React codebases with framework-specific plugins added on top.
  • Gradually adopting stricter rules in a large existing codebase using suppressions.

Quick start

  1. 1

    Install XO locally in your project

    npm install xo --save-dev
  2. 2

    Run XO to lint your project

    npx xo

Things to know

  • XO requires your project to be ESM.
  • It is a wrapper around ESLint, so built-in rule issues go to the ESLint project.
  • Code style is opinionated, with tabs, single quotes and semicolons by default unless configured otherwise.

In collections

Topics

FAQ

What is xo?
A zero-config JavaScript/TypeScript linter that wraps ESLint with opinionated, strict defaults and a built-in code style. XO is a command-line linter for JavaScript and TypeScript that wraps ESLint with a set of opinionated defaults. Running it in a project lints JS, TS, and framework files, and also HTML, Markdown, JSON and CSS, without needing to list file paths or write an ESLint config. It is aimed at teams that want to stop debating code style in pull requests and let the tool enforce one consistent set of rules.
Is xo free to use? What license does it have?
xo is open source under the MIT license. Check the license terms before using it in commercial products.
Is xo still maintained?
Updated within 6 months. The last commit to xo was on Sep 18, 2026.
What can I use xo for?
Enforcing a consistent code style across a team without writing an ESLint config. Adding a linter to a new JavaScript or TypeScript project with a single command. Linting Vue, Svelte, Astro or React codebases with framework-specific plugins added on top. Gradually adopting stricter rules in a large existing codebase using suppressions.
How do I install xo?
Install XO locally in your project: npm install xo --save-dev Run XO to lint your project: npx xo
Where can I get xo?
The source code and installation instructions are on GitHub: https://github.com/xojs/xo

Summary generated by AI from the project's README. GitHub stats refresh daily.

Related projects