Prettier
Prettier is an opinionated code formatter.
If you used the CLI method to install Minze you can extend your environment with auto-code formatting quite quickly.
The following guide is based on a fresh Minze CLI installation.
- Install dependencies.
bash
$ npm add -D prettier
bash
$ yarn add -D prettier
bash
$ pnpm add -D prettier
bash
$ bun add -D prettier
- Add format script to
package.json
.
json
{
"scripts": {
// ...
"format": "prettier --write --cache ."
}
}
- Create and populate
.prettierignore
and.prettierrc.json
files.
txt
├─ src/
├─ ...
├─ .prettierignore
└─ .prettierrc.json
dist
package-lock.json
.*cache
cache
*.d.ts
*.mdx
*.dev.html
storybook
json
{
"$schema": "https://json.schemastore.org/prettierrc",
"singleQuote": true,
"semi": false,
"trailingComma": "none"
}
- Format your code.
bash
$ npm run format
bash
$ yarn run format
bash
$ pnpm run format
bash
$ bun run format
TIP
For more details about Prettier refer to the Prettier docs.