Registry / testing / prettier-check

prettier-check

JSON →
library2.0.0jsnpmunverified

A CLI tool to verify that all files match Prettier code style during CI or testing. Version 2.0.0 requires Node >=4 and a peer dependency on prettier. It forwards all arguments to prettier, making it easy to integrate into npm test scripts. Compared to alternatives like lint-staged, prettier-check focuses solely on checking formatting without auto-fixing, ideal for pre-commit hooks or CI gates.

npm install prettier-check
INSTALL
IMPORT
SIG · PRETTIER-CHECK
P
prettier-check
testingjavascriptv2.0.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.

prettier-check (cli)
npx prettier-check --single-quote src/**/*.js
npx prettier-check --check src/**/*.js
prettier-check v2 does not support --check flag; all arguments forwarded to prettier.
npm script usage
"check-format": "prettier-check src/**/*.js"
"check-format": "prettier-check --list-different src/**/*.js"
prettier-check v2 only returns exit code; for listing files use prettier's --list-different instead.
require or import
not applicable; CLI only
const prettierCheck = require('prettier-check');
prettier-check is a CLI tool only; cannot be imported programmatically. Use child_process.exec or similar to invoke.

Shows how to integrate prettier-check into npm test scripts, passing Prettier options via CLI arguments.

{ "scripts": { "test": "prettier-check --single-quote --trailing-comma es5 src/**/*.js" } }
prettier-check --version
Debug
Known issues
gotchaprettier-check does not auto-fix files; it only returns exit code 1 on mismatch.
fix
Use prettier --write locally or in pre-commit hooks for auto-formatting.
affects: all
breakingVersion 2.0.0 changed behavior: it no longer lists non-conforming files; exit code only.
fix
For file listing, switch to prettier --list-different or use prettier-check@1.x.
affects: >=2.0.0
deprecatedprettier-check v1 is deprecated; upgrade to v2 for better compatibility with latest prettier.
fix
Update to prettier-check@2.0.0 but note changed behavior.
affects: <2.0.0
gotchaGlob patterns must be quoted in npm scripts to avoid shell expansion.
fix
Use double quotes: "prettier-check 'src/**/*.js'" or escape glob.
affects: all
gotchaprettier must be installed as a dependency; global prettier may not be found.
fix
Ensure prettier is listed in devDependencies or installed globally.
affects: all
Errors
Common errors & fixes
Error: Cannot find module 'prettier'
prettier is not installed or not in node_modules.
fix
Run npm install --save-dev prettier
prettier-check: No files to check
Glob pattern did not match any files due to quoting or path issues.
fix
Double-check glob pattern and ensure files exist. Use quotes in npm scripts: 'src/**/*.js'
SyntaxError: Unexpected token ...
Using ES2015+ syntax (e.g., object spread) in Node <4 without transpilation.
fix
Update Node to >=4 or use a transpiler like Babel.
Upgrade
Version history
2.0.0latest on npm
Audit
Dependencies
prettierrequiredpeer dependency required to perform actual formatting check
Agent activity
6 hits · last 30 days
node
6
Resources
prettier-check — npm install prettier-check · libregistry