mirror of
https://github.com/acamarata/prettier-config.git
synced 2026-06-30 19:04:27 +00:00
1.8 KiB
1.8 KiB
@acamarata/prettier-config
Shared Prettier configuration for acamarata JavaScript and TypeScript packages.
Install
npm install --save-dev @acamarata/prettier-config prettier
Or with pnpm:
pnpm add -D @acamarata/prettier-config prettier
Prettier 3.x is required as a peer dependency.
Usage
Reference the package in your package.json:
{
"prettier": "@acamarata/prettier-config"
}
That is all you need for the defaults. Prettier reads the prettier field and loads the config automatically.
Defaults
| Option | Value |
|---|---|
printWidth |
100 |
tabWidth |
2 |
useTabs |
false |
singleQuote |
false |
trailingComma |
"all" |
semi |
true |
bracketSpacing |
true |
arrowParens |
"always" |
endOfLine |
"lf" |
File-type overrides
| File pattern | Override |
|---|---|
*.md, *.mdx |
printWidth: 80, proseWrap: "always", trailingComma: "none" |
*.json, *.jsonc |
trailingComma: "none" |
*.yaml, *.yml |
singleQuote: true, trailingComma: "none" |
Extending
If you need to override specific options, use a prettier.config.mjs file in your project:
import acamarataConfig from "@acamarata/prettier-config";
/** @type {import("prettier").Config} */
export default {
...acamarataConfig,
// Your overrides here
printWidth: 120,
};
Note: the prettier field in package.json does not support extending. Use a config file
when you need project-specific overrides.
License
MIT