Registry / testing / prettierx

prettierx

JSON →
library0.19.0jsnpmunverified

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.

npm install prettierx
INSTALL
IMPORT
SIG · PRETTIERX
P
prettierx
testingjavascriptv0.19.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.

default
import prettierx from 'prettierx';
const prettierx = require('prettierx');
prettierx is ESM-only; CommonJS require will fail if used programmatically.
format
import { format } from 'prettierx';
const { format } = require('prettierx');
Use named export for formatting function.
resolveConfig
import { resolveConfig } from 'prettierx';
resolveConfig is available for config resolution, similar to Prettier.
check
import { check } from 'prettierx';
check is available for checking if files are formatted.

Demonstrates using prettierx programmatically with additional options like alignObjectProperties and spaceBeforeFunctionParen.

import { format } from 'prettierx'; const code = `const foo = {a:1,b:2}`; const options = { alignObjectProperties: true, spaceBeforeFunctionParen: true }; const formatted = format(code, { parser: 'babel', ...options }); console.log(formatted); // Output: // const foo = { // a: 1, // b: 2 // };
prettierx --version
Debug
Known issues
breakingprettierx 0.14.0 dropped support for Node <12 and switched to using Babel for TypeScript parsing by default.
fix
Upgrade to Node >=12.17.0 and update any TypeScript parser configuration.
affects: <0.14.0
deprecatedOption `--no-align-ternary-lines` was replaced with `--offset-ternary-expressions` in v0.17.0.
fix
Use `--offset-ternary-expressions` or `offsetTernaryExpressions: true` instead.
affects: >=0.17.0
deprecatedOptions `--no-bracket-spacing` and `--paren-spacing` were replaced with finer-grained options in v0.17.0.
fix
Use specific spacing options like `--array-bracket-spacing`, `--computed-property-spacing`, etc.
affects: >=0.17.0
gotchaSome options like `arrayBracketSpacing`, `cssParenSpacing`, `computedPropertySpacing`, `spaceInParens`, `spaceUnaryOps`, `templateCurlySpacing`, `typeAngleBracketSpacing`, `typeBracketSpacing` are experimental with limited testing and may produce unexpected formatting.
fix
Test thoroughly before enabling experimental options in production.
affects: >=0.14.0
gotchaThe `--import-formatting oneline` option may conflict with VSCode's Organize Imports feature.
fix
Use `importFormatting: 'auto'` or disable VSCode Organize Imports if using `oneline`.
affects: >=0.15.0
gotchaprettierx is ESM-only for programmatic use; `require('prettierx')` will throw an error.
fix
Use `import` statements or `dynamic import()`.
affects: >=0.18.0
Errors
Common errors & fixes
Cannot find module 'prettierx'
Trying to require('prettierx') in a CommonJS project.
fix
Use `import('prettierx')` or switch to ES modules.
Error: Invalid option: 'alignObjectProperties'
Using an option that does not exist in Prettier or older prettierx version.
fix
Ensure you are using prettierx, not Prettier, and update to a version that supports the option (>=0.14.0).
TypeError: prettierx.format is not a function
Importing wrong export (default vs named).
fix
Use `import { format } from 'prettierx'` instead of default import.
Error: Cannot use 'import.meta' outside a module
Trying to use prettierx programmatically without 'type': 'module' in package.json or without .mjs extension.
fix
Add 'type': 'module' to your package.json or use .mjs extension for your script.
Upgrade
Version history
0.19.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
4 hits · last 30 days
node
4
Resources