{"id":20453,"library":"prettier-plugin-x","title":"prettier-plugin-x","description":"A Prettier plugin that integrates enhanced estree printer options from prettierX, supporting Babel, TypeScript (via bundled TS), and Flow parsers (x-babel, x-babel-ts, x-babel-flow, x-typescript). v0.0.10 is the latest stable version, with no new releases since 2020. Requires Prettier ^2.0.0 and explicit parser configuration. Key differentiator: provides prettierX's formatting options not available in standard Prettier, such as generatorStarSpacing and spaceBeforeFunctionParen, to align with Standard JS style. Alternative: prettier-plugin-x-babel for more reliable Babel parsing.","status":"deprecated","version":"0.0.10","language":"javascript","source_language":"en","source_url":"https://github.com/brodybits/prettier-plugin-x#readme","tags":["javascript"],"install":[{"cmd":"npm install prettier-plugin-x","lang":"bash","label":"npm"},{"cmd":"yarn add prettier-plugin-x","lang":"bash","label":"yarn"},{"cmd":"pnpm add prettier-plugin-x","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"peer dependency; the plugin requires Prettier >=2.0.0 and <3.0.0 to load as a plugin","package":"prettier","optional":false}],"imports":[{"note":"Prettier is ESM-only since v3, but v2 supports both CJS and ESM.","wrong":"const prettier = require('prettier');","symbol":"default import","correct":"import prettier from 'prettier';"},{"note":"The plugin is auto-loaded by Prettier when installed; no explicit import in user code.","symbol":"Prettier config","correct":"// configuration is done via .prettierrc or CLI flags; no programmatic import from plugin needed"},{"note":"Options is a type, not a value; use 'import type' to avoid runtime errors.","wrong":"import { Options } from 'prettier';","symbol":"types","correct":"import type { Options } from 'prettier';"}],"quickstart":{"code":"// Install the plugin and Prettier\n// npm install --save-dev prettier prettier-plugin-x\n\n// Create .prettierrc with explicit parser and prettierX options\n{\n  \"parser\": \"x-babel\",\n  \"semi\": false,\n  \"generatorStarSpacing\": true,\n  \"spaceBeforeFunctionParen\": true\n}\n\n// Format a file\n// npx prettier --write sample.js\n\n// sample.js input:\nfunction * a () {}\n\nconsole.log(typeof a)\n\n// Expected output:\nfunction* a() {}\n\nconsole.log(typeof a)","lang":"javascript","description":"Install prettier-plugin-x, configure Prettier to use x-babel parser and prettierX-specific options, and format a sample JS file."},"warnings":[{"fix":"Switch to parser x-typescript for TypeScript files, or use prettier-plugin-x-babel for Babel-based TS parsing.","message":"The x-babel-ts parser may not correctly parse some TypeScript syntax compared to the official TypeScript parser. Use x-typescript or prettier-plugin-x-babel for better TS support.","severity":"breaking","affected_versions":">=0.0.0"},{"fix":"Migrate to prettier-plugin-x-babel or other actively maintained Prettier plugins.","message":"The plugin has not been updated since 2020 and relies on Prettier v2. It is not compatible with Prettier v3.","severity":"deprecated","affected_versions":">=0.0.0"},{"fix":"Consider using @prettier/plugin-babel or @prettier/plugin-typescript for standard formatting.","message":"prettierX project itself is deprecated; this plugin inherits its options which may not be maintained further.","severity":"deprecated","affected_versions":">=0.0.0"},{"fix":"Add 'parser': 'x-babel' (or x-babel-ts, x-babel-flow, x-typescript) to your .prettierrc.","message":"Must explicitly set parser in Prettier config; the plugin does not auto-detect file type.","severity":"breaking","affected_versions":">=0.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-plugin-x'.","cause":"Plugin not installed or not in node_modules.","error":"Cannot find module 'prettier-plugin-x'"},{"fix":"Specify parser in config: --parser=x-babel or add to .prettierrc.","cause":"Prettier cannot determine which parser to use; the plugin's parsers are not automatically selected.","error":"Error: No parser and no file path given, couldn't infer a parser."},{"fix":"Ensure prettier-plugin-x is installed and use valid parser names: x-babel, x-babel-ts, x-babel-flow, x-typescript.","cause":"Incorrect parser name or plugin not loaded.","error":"Error: Invalid parser value: 'x-babel'. Expected: ..."}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}