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 prettierbash
$ yarn add -D prettierbash
$ pnpm add -D prettierbash
$ bun add -D prettier- Add format script to
package.json.
json
{
"scripts": {
// ...
"format": "prettier --write --cache ."
}
}- Create and populate
.prettierignoreand.prettierrc.jsonfiles.
txt
├─ src/
├─ ...
├─ .prettierignore // [!code ++]
└─ .prettierrc.json // [!code ++]dist
package-lock.json
.*cache
cache
*.d.ts
*.mdx
*.dev.html
storybookjson
{
"$schema": "https://json.schemastore.org/prettierrc",
"singleQuote": true,
"semi": false,
"trailingComma": "none"
}- Format your code.
bash
$ npm run formatbash
$ yarn run formatbash
$ pnpm run formatbash
$ bun run formatTIP
For more details about Prettier refer to the Prettier docs.