prettier-config-standard
raw JSON → 7.0.0 verified Mon Apr 27 auth: no javascript
A shareable Prettier configuration that enforces JavaScript Standard Style formatting rules. Version 7.0.0 is the latest stable release, compatible with Prettier ^2.6.0 or ^3.0.0. It explicitly sets Prettier options to match the Standard style, including arrowParens, bracketSameLine, singleAttributePerLine, endOfLine, and JSX quote handling. Unlike directly using Standard, this config works with Prettier as a standalone formatter without ESLint. Updated with each Prettier major release to track option changes and peer dependency ranges.
Common errors
error Error: Cannot find module 'prettier-config-standard' ↓
cause The package is not installed.
fix
Run: npm install --save-dev prettier-config-standard
error Cannot read properties of undefined (reading 'someOption') when using require('prettier-config-standard') and merging ↓
cause The module exports a string, not an object. Using require returns the string, not a config object.
fix
If you want to extend the config, use: const prettierConfigStandard = require('prettier-config-standard') and then reference the string. For merging, use require.resolve('prettier-config-standard') to get the path, or just use the string directly in package.json.
error Invalid configuration file: "prettier-config-standard" is not a valid configuration object or string ↓
cause You may be trying to use the config in a JSON file that expects a different format, or have a syntax error.
fix
Ensure your .prettierrc.json contains exactly "prettier-config-standard". For .prettierrc.js, use module.exports = 'prettier-config-standard';
Warnings
breaking In v4.0.0, arrowParens changed from 'avoid' to 'always'. Code that relied on omitting parentheses around single-parameter arrow functions will now have parentheses added. ↓
fix Update code to include parentheses on all arrow function parameters, or pin to v3.x if needed.
breaking In v5.0.0, jsxBracketSameLine was replaced with bracketSameLine. Prettier < 2.4.0 is no longer supported. If using Prettier < 2.4.0, this config will cause errors. ↓
fix Upgrade Prettier to ^2.4.0 or later. If you must use older Prettier, stay on v4.x.
breaking In v3.0.0, endOfLine changed from 'auto' to 'lf'. Windows users may see line ending changes when formatting. Re-cloning the repository may be needed after running Prettier. ↓
fix Ensure your editor and git config handle LF line endings. Optionally override endOfLine in your own Prettier config.
deprecated Version 6.0.0 added support for Prettier 3.x. Prettier 2.x is still supported but may eventually drop. ↓
fix Use Prettier ^3.0.0 if possible; otherwise ensure your Prettier version satisfies '^2.6.0 || ^3.0.0'.
gotcha This config does not install Prettier, Standard, or ESLint. Users often assume it will install Prettier as a dependency. ↓
fix Ensure you also install Prettier separately: npm install --save-dev prettier
Install
npm install prettier-config-standard yarn add prettier-config-standard pnpm add prettier-config-standard Imports
- default (string) wrong
module.exports = require('prettier-config-standard')correctmodule.exports = 'prettier-config-standard' - default (string) wrong
"prettier": { "extends": "prettier-config-standard" }correct"prettier": "prettier-config-standard" - require for extending wrong
import prettierConfigStandard from 'prettier-config-standard'correctconst prettierConfigStandard = require('prettier-config-standard')
Quickstart
// Install
npm install --save-dev prettier prettier-config-standard
// .prettierrc.js
module.exports = 'prettier-config-standard';
// Or package.json
{
"name": "my-project",
"prettier": "prettier-config-standard",
"devDependencies": {
"prettier": "^3.0.0",
"prettier-config-standard": "^7.0.0"
}
}
// Format a file
npx prettier --write src/index.js