Registry / web-framework / prettier-plugin-x

prettier-plugin-x

JSON →
library0.0.10jsnpmunverified

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.

npm install prettier-plugin-x
INSTALL
IMPORT
SIG · PRETTIER-PLUGIN-X
P
prettier-plugin-x
web-frameworkjavascriptv0.0.10
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
import prettier from 'prettier';
const prettier = require('prettier');
Prettier is ESM-only since v3, but v2 supports both CJS and ESM.
Prettier config
// configuration is done via .prettierrc or CLI flags; no programmatic import from plugin needed
The plugin is auto-loaded by Prettier when installed; no explicit import in user code.
types
import type { Options } from 'prettier';
import { Options } from 'prettier';
Options is a type, not a value; use 'import type' to avoid runtime errors.

Install prettier-plugin-x, configure Prettier to use x-babel parser and prettierX-specific options, and format a sample JS file.

// Install the plugin and Prettier // npm install --save-dev prettier prettier-plugin-x // Create .prettierrc with explicit parser and prettierX options { "parser": "x-babel", "semi": false, "generatorStarSpacing": true, "spaceBeforeFunctionParen": true } // Format a file // npx prettier --write sample.js // sample.js input: function * a () {} console.log(typeof a) // Expected output: function* a() {} console.log(typeof a)
Debug
Known issues
breakingThe 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.
fix
Switch to parser x-typescript for TypeScript files, or use prettier-plugin-x-babel for Babel-based TS parsing.
affects: >=0.0.0
deprecatedThe plugin has not been updated since 2020 and relies on Prettier v2. It is not compatible with Prettier v3.
fix
Migrate to prettier-plugin-x-babel or other actively maintained Prettier plugins.
affects: >=0.0.0
deprecatedprettierX project itself is deprecated; this plugin inherits its options which may not be maintained further.
fix
Consider using @prettier/plugin-babel or @prettier/plugin-typescript for standard formatting.
affects: >=0.0.0
breakingMust explicitly set parser in Prettier config; the plugin does not auto-detect file type.
fix
Add 'parser': 'x-babel' (or x-babel-ts, x-babel-flow, x-typescript) to your .prettierrc.
affects: >=0.0.0
Errors
Common errors & fixes
Cannot find module 'prettier-plugin-x'
Plugin not installed or not in node_modules.
fix
Run 'npm install --save-dev prettier-plugin-x'.
Error: No parser and no file path given, couldn't infer a parser.
Prettier cannot determine which parser to use; the plugin's parsers are not automatically selected.
fix
Specify parser in config: --parser=x-babel or add to .prettierrc.
Error: Invalid parser value: 'x-babel'. Expected: ...
Incorrect parser name or plugin not loaded.
fix
Ensure prettier-plugin-x is installed and use valid parser names: x-babel, x-babel-ts, x-babel-flow, x-typescript.
Upgrade
Version history
0.0.10latest on npm
Audit
Dependencies
prettierrequiredpeer dependency; the plugin requires Prettier >=2.0.0 and <3.0.0 to load as a plugin
Agent activity
6 hits · last 30 days
node
6
Resources
prettier-plugin-x — npm install prettier-plugin-x · libregistry