{"id":20469,"library":"prettierx","title":"prettierx","description":"prettierx (v0.19.0) is a less opinionated fork of Prettier, offering additional formatting options that align with Standard JS and semistandard. It provides CLI usage and can be used as a standalone formatter or via a plugin. Unlike Prettier, prettierx includes options like `alignObjectProperties`, `offsetTernaryExpressions`, `spaceBeforeFunctionParen`, and `breakBeforeElse`. It requires Node >=12.17.0 and is currently in active maintenance with irregular release cadence. The package is ESM-only for programmatic use but provides a CommonJS-compatible CLI.","status":"maintenance","version":"0.19.0","language":"javascript","source_language":"en","source_url":"https://github.com/brodybits/prettierx","tags":["javascript"],"install":[{"cmd":"npm install prettierx","lang":"bash","label":"npm"},{"cmd":"yarn add prettierx","lang":"bash","label":"yarn"},{"cmd":"pnpm add prettierx","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"prettierx is ESM-only; CommonJS require will fail if used programmatically.","wrong":"const prettierx = require('prettierx');","symbol":"default","correct":"import prettierx from 'prettierx';"},{"note":"Use named export for formatting function.","wrong":"const { format } = require('prettierx');","symbol":"format","correct":"import { format } from 'prettierx';"},{"note":"resolveConfig is available for config resolution, similar to Prettier.","wrong":null,"symbol":"resolveConfig","correct":"import { resolveConfig } from 'prettierx';"},{"note":"check is available for checking if files are formatted.","wrong":null,"symbol":"check","correct":"import { check } from 'prettierx';"}],"quickstart":{"code":"import { format } from 'prettierx';\n\nconst code = `const foo = {a:1,b:2}`;\nconst options = {\n  alignObjectProperties: true,\n  spaceBeforeFunctionParen: true\n};\nconst formatted = format(code, { parser: 'babel', ...options });\nconsole.log(formatted);\n// Output:\n// const foo = {\n//   a: 1,\n//   b: 2\n// };","lang":"typescript","description":"Demonstrates using prettierx programmatically with additional options like alignObjectProperties and spaceBeforeFunctionParen."},"warnings":[{"fix":"Upgrade to Node >=12.17.0 and update any TypeScript parser configuration.","message":"prettierx 0.14.0 dropped support for Node <12 and switched to using Babel for TypeScript parsing by default.","severity":"breaking","affected_versions":"<0.14.0"},{"fix":"Use `--offset-ternary-expressions` or `offsetTernaryExpressions: true` instead.","message":"Option `--no-align-ternary-lines` was replaced with `--offset-ternary-expressions` in v0.17.0.","severity":"deprecated","affected_versions":">=0.17.0"},{"fix":"Use specific spacing options like `--array-bracket-spacing`, `--computed-property-spacing`, etc.","message":"Options `--no-bracket-spacing` and `--paren-spacing` were replaced with finer-grained options in v0.17.0.","severity":"deprecated","affected_versions":">=0.17.0"},{"fix":"Test thoroughly before enabling experimental options in production.","message":"Some options like `arrayBracketSpacing`, `cssParenSpacing`, `computedPropertySpacing`, `spaceInParens`, `spaceUnaryOps`, `templateCurlySpacing`, `typeAngleBracketSpacing`, `typeBracketSpacing` are experimental with limited testing and may produce unexpected formatting.","severity":"gotcha","affected_versions":">=0.14.0"},{"fix":"Use `importFormatting: 'auto'` or disable VSCode Organize Imports if using `oneline`.","message":"The `--import-formatting oneline` option may conflict with VSCode's Organize Imports feature.","severity":"gotcha","affected_versions":">=0.15.0"},{"fix":"Use `import` statements or `dynamic import()`.","message":"prettierx is ESM-only for programmatic use; `require('prettierx')` will throw an error.","severity":"gotcha","affected_versions":">=0.18.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Use `import('prettierx')` or switch to ES modules.","cause":"Trying to require('prettierx') in a CommonJS project.","error":"Cannot find module 'prettierx'"},{"fix":"Ensure you are using prettierx, not Prettier, and update to a version that supports the option (>=0.14.0).","cause":"Using an option that does not exist in Prettier or older prettierx version.","error":"Error: Invalid option: 'alignObjectProperties'"},{"fix":"Use `import { format } from 'prettierx'` instead of default import.","cause":"Importing wrong export (default vs named).","error":"TypeError: prettierx.format is not a function"},{"fix":"Add 'type': 'module' to your package.json or use .mjs extension for your script.","cause":"Trying to use prettierx programmatically without 'type': 'module' in package.json or without .mjs extension.","error":"Error: Cannot use 'import.meta' outside a module"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}