prettier-standard

raw JSON →
16.4.1 verified Sat Apr 25 auth: no javascript

Prettier-standard is a CLI tool that combines prettierx (a prettier fork) for code formatting with eslint preconfigured with the standard ruleset. Current version 16.4.1 (requires Node >=8) wraps prettierx and eslint to format and optionally lint JavaScript/TypeScript/CSS files. It simplifies setup by eliminating separate eslint config for whitespace, and provides flags like --staged, --changed, --since for git-aware formatting. Since v9.0.0, it uses .prettierrc for config instead of .eslintrc, and v12.0.0 was a complete rewrite without spawning subprocesses, improving speed. It is well-suited for teams wanting standard-compliant code with minimal configuration, but note that it uses prettierx, not upstream prettier, and may have slight formatting differences.

error Error: Cannot find module 'prettier-standard'
cause Package not installed or not in node_modules
fix
Run 'npm install prettier-standard' or 'yarn add prettier-standard' (devDependency).
error prettier-standard: command not found
cause Package not installed globally or not in PATH
fix
Install globally: 'npm install -g prettier-standard', or use npx: 'npx prettier-standard'.
error SyntaxError: Unexpected token (1:1) while parsing /path/to/file
cause Trying to format a file with an unsupported extension or syntax
fix
Ensure the file has a recognized extension (.js, .jsx, .ts, .tsx, .css, etc.) or use --parser flag.
breaking Since v9.0.0, prettier-standard no longer passes code through 'standard --fix'. It uses prettierx instead.
fix If you relied on standard --fix behavior, you may need to check formatting differences. Custom configuration now goes in .prettierrc, not .eslintrc.
breaking Since v9.0.0, custom configuration happens through .prettierrc instead of .eslintrc. Output matches prettier output.
fix Move any eslint-based formatting config to .prettierrc. Extend 'prettier' and 'prettier/standard' in .eslintrc for linting.
gotcha --lines flag is experimental; prettier has known issues with range formatting (prettier#4926, prettier#6428).
fix Avoid using --lines if possible. Use --changed or --staged instead.
gotcha This package uses prettierx, not upstream prettier. Formatting may differ slightly from prettier.
fix If you need exact prettier formatting, use prettier directly and configure eslint separately.
npm install prettier-standard
yarn add prettier-standard
pnpm add prettier-standard

Shows typical CLI usage: global/local install, formatting with linting, staged files, and git-aware formatting.

// Install globally or locally
npm install -g prettier-standard

// Format all files in project and lint
prettier-standard --lint

// Format only staged files (for precommit hooks)
prettier-standard --staged

// Format changed lines since master
prettier-standard --changed --since master

// Use as a lint-staged step in package.json
"lint-staged": {
  "*.{js,jsx,ts,tsx,css}": ["prettier-standard --lint"]
}