prettier-standard-formatter
raw JSON → 1.0.1 verified Sat Apr 25 auth: no javascript deprecated
Prettier configured with JavaScript Standard Style rules for zero-config code formatting. Current version 1.0.1 (last released 2019). Combines prettier's formatting with standard style (no semicolons, single quotes, etc.). Useful for projects already using standard but wanting prettier's advanced formatting. Note: CLI version uses local installation if available.
Common errors
error Error: Cannot find module 'prettier' ↓
cause Peer dependency prettier not installed.
fix
npm install prettier
error TypeError: prettierStandard.format is not a function ↓
cause Using require wrongly (missing .format).
fix
Use const prettierStandard = require('prettier-standard'); then prettierStandard.format(source).then(...)
Warnings
deprecated Package has not been updated since 2019 and may not work with newer prettier versions. ↓
fix Consider using prettier with a standard config like eslint-config-standard or prettier-config-standard.
gotcha The format function returns a Promise in the API but CLI uses synchronous-like usage. ↓
fix Always await or .then() the format call.
breaking CLI behavior differs from API: CLI uses local installation if available, else global. ↓
fix Ensure correct package installation path for CLI.
Install
npm install standard-prettier yarn add standard-prettier pnpm add standard-prettier Imports
- format wrong
const prettierStandard = require('prettier-standard')correctimport { format } from 'prettier-standard' - prettierStandard wrong
import prettierStandard from 'prettier-standard'correctconst prettierStandard = require('prettier-standard') - format wrong
import format from 'prettier-standard'correctimport { format } from 'prettier-standard'
Quickstart
import { format } from 'prettier-standard'
const code = `const x = 'hello' `
format(code).then(result => {
console.log(result)
// Output: const x = 'hello'
})