Registry / devops / prettier-config-xo

prettier-config-xo

JSON →
library2.0.2jsnpmunverified

Prettier shareable config that enforces the XO code style. Current stable version is 2.0.2, released November 2025, with active maintenance via GitHub Actions CI/CD. Key differentiator: it provides a zero-config Prettier setup directly matching XO's opinionated style, including optional space-based indentation. Ships TypeScript type definitions and supports ESM via exports field. v2.0 breaking change introduced mandatory trailing commas to align with XO 0.41.0.

npm install prettier-config-xo
INSTALL
IMPORT
SIG · PRETTIER-CONFIG-XO
P
prettier-config-xo
devopsjavascriptv2.0.2
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.

default config
import config from 'prettier-config-xo'
const config = require('prettier-config-xo')
Default export provides an object with Prettier options. CJS is still supported via module.exports but ESM is preferred.
space config
import spaceConfig from 'prettier-config-xo/space'
import spaceConfig from 'prettier-config-xo'
The /space subpath export configures spaces instead of tabs. Available since v1.0.4.
type inference
import type { Config } from 'prettier-config-xo'
Types are shipped as .d.ts files and work with TypeScript without additional @types packages.

Installation and usage of prettier-config-xo as a shared Prettier config, either via package.json or by extending in a JS config file.

// 1. Install: npm install --save-dev prettier prettier-config-xo // 2. In package.json: { "name": "my-project", "version": "1.0.0", "prettier": "prettier-config-xo" } // 3. To extend in a prettier.config.js: const xoConfig = require('prettier-config-xo'); module.exports = { ...xoConfig, semi: false // Custom override };
Debug
Known issues
breakingTrailing commas are now enforced in v2.0.0 to match XO 0.41.0. Existing codebases may need to run Prettier to add trailing commas.
fix
Run `npx prettier --write .` to auto-apply trailing commas. If you need to preserve no trailing commas, override `trailingComma: 'none'` in your config.
affects: >=2.0.0
breakingThe /space subpath export replaced the prior pattern for spaces. If you used a different subpath in v1.x, it may not work in v2.
fix
Use the correct subpath: `require('prettier-config-xo/space')` or `import config from 'prettier-config-xo/space'`.
affects: >=2.0.0
gotchaUsing `require('prettier-config-xo')` in an ESM context may fail if your project's type is 'module'.
fix
Use dynamic import: `const config = await import('prettier-config-xo');` or switch to ESM import syntax.
affects: >=2.0.0
deprecatedThe `main` field in package.json no longer points to the default export; use the `exports` field.
fix
If you rely on resolution via `main`, update to use the package name directly or specify `exports` in your own config.
affects: >=2.0.0
Errors
Common errors & fixes
Cannot find module 'prettier-config-xo'
Package not installed or not in node_modules.
fix
Run `npm install --save-dev prettier prettier-config-xo`.
ReferenceError: require is not defined
Using CJS `require` in an ESM context (e.g., type: 'module' in package.json).
fix
Use `import config from 'prettier-config-xo'` or use dynamic import.
Module parse failed: Unexpected token (1:0)
Likely using an outdated bundler that doesn't understand package.json exports.
fix
Update bundler to support 'exports' field or use a direct path like `./node_modules/prettier-config-xo/index.js`.
Upgrade
Version history
2.0.2latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
6 hits · last 30 days
node
6
Resources
prettier-config-xo — npm install prettier-config-xo · libregistry