Registry / testing / prettier-cli

prettier-cli

JSON →
library0.1.0jsnpmunverified

A command-line interface for Prettier, an opinionated code formatter. This package is currently a work-in-progress (WIP) and provides a CLI wrapper around Prettier's API. Prettier itself is at version 3.8.3 (January 2026), with a monthly release cadence. Unlike the standalone `prettier` package, this package aims to offer additional CLI features such as progress bars, better error handling, and configuration validation. It is intended for users who want an enhanced CLI experience while leveraging Prettier's formatting capabilities.

npm install prettier-cli
INSTALL
IMPORT
SIG · PRETTIER-CLI
P
prettier-cli
testingjavascriptv0.1.0
Install
—
Import
—
Disk
—
Pass rate
0/ 6
Env Coverage0 / 6
glibc
18–22
musl
18–22
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 18–226 runs
build_error
glibc
node 18–226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
✓ import prettier from 'prettier'
✗ const prettier = require('prettier')
Prettier is ESM-only since v3; require() will fail.
check
✓ import { check } from 'prettier'
✗ import check from 'prettier'
check is a named export, not default.
format
✓ import { format } from 'prettier'
✗ const format = require('prettier').format
Named export, ESM-only since v3.

Demonstrates basic usage of Prettier's format function to format a JavaScript file.

#!/usr/bin/env node import { format } from 'prettier'; import fs from 'fs'; const code = fs.readFileSync('input.js', 'utf8'); const formatted = await format(code, { parser: 'babel' }); console.log(formatted);
prettier-cli --version
Debug
Known issues
breakingPrettier v3 is ESM-only; CommonJS require() will throw.
fix
Switch to ESM imports or use dynamic import().
affects: >=3.0
deprecatedPrettier's CLI `--write` flag is deprecated in favor of `--write` with explicit file list.
fix
Use `prettier --write file.js` instead of `prettier --write .` without arguments.
affects: >=2.0
gotchaPrettier may reformat code even when --check is used; ensure your code is actually formatted.
fix
Always review diffs before committing.
affects: >=1.0
gotchaPrettier does not lint code; it only formats. Use with ESLint for full code quality.
fix
Run Prettier before ESLint to avoid conflicts.
affects: >=1.0
Errors
Common errors & fixes
Error [ERR_REQUIRE_ESM]: require() of ES Module ... from ... not supported.
Using require() to import Prettier v3 which is ESM-only.
fix
Use ESM imports (import ... from 'prettier') or use dynamic import() in CommonJS.
SyntaxError: Unexpected token '??='
Prettier does not support all modern JavaScript syntax by default.
fix
Use the correct parser (e.g., 'babel' for JSX) and ensure Prettier is up-to-date.
Cannot find module 'prettier'
Prettier not installed or not in node_modules.
fix
Run `npm install prettier` to install the package.
Upgrade
Version history
0.1.0latest on npm
Audit
Dependencies
prettierrequiredCore formatting engine; prettier-cli is a wrapper around Prettier's API.
Agent activity
4 hits · last 30 days
node
4
Resources
prettier-cli — npm install prettier-cli · libregistry