Registry / testing / xo
library1.0.0jsnpmunverified

XO is an opinionated JavaScript and TypeScript linter that wraps ESLint, providing a zero-configuration setup with strict, readable code defaults. It aims to streamline code style enforcement and eliminate style-related discussions in pull requests. The current stable version is 2.0.2, with a relatively active release cadence to incorporate updates and maintain compatibility with its underlying dependencies. Key differentiators include its batteries-included approach, which bundles many useful ESLint plugins (e.g., `unicorn`, `import-x`, `n`), automatic caching for performance, first-class TypeScript support, and flexible integration options, including optional Prettier usage. It mandates an ESM-only project structure for optimal functionality.

npm install xo
INSTALL
IMPORT
SIG · XO
X
xo
testingjavascriptv1.0.0
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

xo
import xo from 'xo';
const xo = require('xo');
XO is an ESM-only package since v2.0.0. Direct programmatic usage is typically for advanced scenarios, as it's primarily a CLI tool.
create-xo
npm init xo
This is a command-line utility for quickly adding XO to a new or existing project, not a direct JavaScript import.
eslint-config-xo-react
/* configured via 'react' option or implicitly */
XO integrates React linting via the `--react` CLI flag or `react: true` in its configuration, which internally uses `eslint-config-xo-react`. It's not typically imported directly by the user.

Demonstrates how to install XO as a dev dependency, configure it in `package.json`, and run it from the command line, including using the `--fix` flag to automatically resolve issues.

{ "name": "my-project", "version": "1.0.0", "type": "module", "devDependencies": { "xo": "^2.0.0" }, "scripts": { "lint": "xo", "lint:fix": "xo --fix" } } // src/index.js const myVar = 'hello' ; // Linting issue: extra space, single quotes function MyComponent(props) { // Linting issue: function-style component for React return (<div>{props.message}</div>); } console.log(myVar, MyComponent); // To run: // npm install // npm run lint // npm run lint:fix
xo --version
Debug
Known issues
breakingXO v2.0.0 and later require Node.js version 20.19 or higher. Older Node.js versions are not supported.
fix
Upgrade your Node.js environment to version 20.19 or newer.
affects: >=2.0.0
breakingXO v2.0.0 and later require ESLint version 10. Ensure your project's ESLint dependency (if any) is compatible or allow XO to manage its own ESLint peer dependency.
fix
Update your local ESLint installation to `eslint@^10.0.0` or higher, or remove it if you intend for XO to manage it exclusively.
affects: >=2.0.0
breakingCommonJS (CJS) config files are no longer supported. Configuration must be provided in ES module format (e.g., `.js`, `.mjs`, `.ts`, `.mts`) as XO is an ESM-only package.
fix
Migrate your `xo.config.cjs` or similar CJS configuration files to `.js`, `.mjs`, or TypeScript equivalents, ensuring they use `export default` syntax.
affects: >=2.0.0
breakingThe `eslint-plugin-promise` rules were temporarily removed in v2.0.0 due to compatibility issues with ESLint 10. This may affect existing projects relying on these specific rules.
fix
Be aware that these rules are currently disabled. Monitor the XO changelog for re-introduction once ESLint 10 compatibility is resolved for the plugin.
affects: >=2.0.0
gotchaXO is strictly an ESM-only package. Attempting to use `require()` or run XO in a non-ESM Node.js environment will result in errors.
fix
Ensure your project's `package.json` contains `"type": "module"` if you are using `.js` files, or use `.mjs` or TypeScript files. For CLI usage, `npx xo` should handle the environment correctly.
affects: >=2.0.0
Errors
Common errors & fixes
Error [ERR_REQUIRE_ESM]: require() of ES Module <path_to_xo>/index.js from <your_file> not supported.
Attempting to import XO programmatically using CommonJS `require()` syntax in an ES module context, or running XO in a project that is not configured as an ES module.
fix
Change your import statement to `import xo from 'xo';` if using XO programmatically. Ensure your `package.json` has `"type": "module"` if your `.js` files are intended to be ESM.
Your current Node.js version is <version>. XO requires Node.js >= 20.19.
The installed Node.js version is older than the minimum required by XO v2.0.0+.
fix
Update your Node.js installation to version 20.19 or newer. Consider using a version manager like `nvm` or `volta`.
ESLint couldn't find the plugin "eslint-plugin-promise".
This specific plugin's rules were temporarily removed from XO v2.0.0 due to compatibility issues with ESLint 10.
fix
This is expected behavior in XO v2.0.0. You cannot re-enable these rules until XO re-integrates them in a future release. Review your linting expectations accordingly.
ESLint couldn't find the config "<config_name>" to extend from.
A configuration file (e.g., `xo.config.js`) might be trying to extend a CJS-specific configuration or an older config that's no longer compatible with ESLint 10.
fix
Verify your `xo.config.js` or similar file is using correct ESM syntax and extending valid, compatible configurations. Ensure there are no CJS-style `module.exports` or `require()` calls within the config file itself.
Upgrade
Version history
1.0.0latest on npm
Audit
Dependencies
eslintrequiredXO is a wrapper around ESLint and requires a compatible version to function correctly.
Agent activity
16 hits · last 30 days
node
16
Resources
xo — npm install xo · libregistry