{"id":20311,"library":"prettier-config-xo","title":"prettier-config-xo","description":"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.","status":"active","version":"2.0.2","language":"javascript","source_language":"en","source_url":"https://github.com/jonahsnider/prettier-config-xo","tags":["javascript","xo","prettier","prettier-config","xo-config","typescript"],"install":[{"cmd":"npm install prettier-config-xo","lang":"bash","label":"npm"},{"cmd":"yarn add prettier-config-xo","lang":"bash","label":"yarn"},{"cmd":"pnpm add prettier-config-xo","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"Default export provides an object with Prettier options. CJS is still supported via module.exports but ESM is preferred.","wrong":"const config = require('prettier-config-xo')","symbol":"default config","correct":"import config from 'prettier-config-xo'"},{"note":"The /space subpath export configures spaces instead of tabs. Available since v1.0.4.","wrong":"import spaceConfig from 'prettier-config-xo'","symbol":"space config","correct":"import spaceConfig from 'prettier-config-xo/space'"},{"note":"Types are shipped as .d.ts files and work with TypeScript without additional @types packages.","wrong":"","symbol":"type inference","correct":"import type { Config } from 'prettier-config-xo'"}],"quickstart":{"code":"// 1. Install: npm install --save-dev prettier prettier-config-xo\n\n// 2. In package.json:\n{\n  \"name\": \"my-project\",\n  \"version\": \"1.0.0\",\n  \"prettier\": \"prettier-config-xo\"\n}\n\n// 3. To extend in a prettier.config.js:\nconst xoConfig = require('prettier-config-xo');\nmodule.exports = {\n  ...xoConfig,\n  semi: false  // Custom override\n};","lang":"javascript","description":"Installation and usage of prettier-config-xo as a shared Prettier config, either via package.json or by extending in a JS config file."},"warnings":[{"fix":"Run `npx prettier --write .` to auto-apply trailing commas. If you need to preserve no trailing commas, override `trailingComma: 'none'` in your config.","message":"Trailing 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.","severity":"breaking","affected_versions":">=2.0.0"},{"fix":"Use the correct subpath: `require('prettier-config-xo/space')` or `import config from 'prettier-config-xo/space'`.","message":"The /space subpath export replaced the prior pattern for spaces. If you used a different subpath in v1.x, it may not work in v2.","severity":"breaking","affected_versions":">=2.0.0"},{"fix":"Use dynamic import: `const config = await import('prettier-config-xo');` or switch to ESM import syntax.","message":"Using `require('prettier-config-xo')` in an ESM context may fail if your project's type is 'module'.","severity":"gotcha","affected_versions":">=2.0.0"},{"fix":"If you rely on resolution via `main`, update to use the package name directly or specify `exports` in your own config.","message":"The `main` field in package.json no longer points to the default export; use the `exports` field.","severity":"deprecated","affected_versions":">=2.0.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Run `npm install --save-dev prettier prettier-config-xo`.","cause":"Package not installed or not in node_modules.","error":"Cannot find module 'prettier-config-xo'"},{"fix":"Use `import config from 'prettier-config-xo'` or use dynamic import.","cause":"Using CJS `require` in an ESM context (e.g., type: 'module' in package.json).","error":"ReferenceError: require is not defined"},{"fix":"Update bundler to support 'exports' field or use a direct path like `./node_modules/prettier-config-xo/index.js`.","cause":"Likely using an outdated bundler that doesn't understand package.json exports.","error":"Module parse failed: Unexpected token (1:0)"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}