Shareable Prettier config for my projects to produce neat and readable code
- Prints single quotes instead of double quotes (including inside of JSX)
- Prints trailing commas where possible (excluding function parameters and calls)
- Prints single attribute per line in HTML, Vue and JSX
- Removes semicolons at the ends of statements
First, you want to install this package as a dev dependency:
$ npm install -D @s1mpson/prettier-config
# or
$ yarn add -D @s1mpson/prettier-config
# or
$ pnpm add -D @s1mpson/prettier-config
# or
$ bun add -D @s1mpson/prettier-config
Now, you just need to reference this module as your Prettier configuration.
- You can do it by either adding
"prettier"
key in yourpackage.json
:
{
// ...
"prettier": "@s1mpson/prettier-config"
}
- Or by creating
.prettierrc
or.prettierrc.json
file with the name of this package as its only content:
"@s1mpson/prettier-config"
VoilĂ ! You now have a working Prettier configuration!