This package includes the shareable Prettier configuration consumed by Brixtol Textiles.
pnpm add prettier @brixtol/prettier-config --save-dev
Prettier is an
optionalDependency
so you will need to install it within your project.
We extend configuration from within package.json
files.
{
"prettier": "@brixtol/prettier-config"
}
Install the esbenp.prettier-vscode extension from the marketplace. Depending on how your editor is configured, one may require setting global configuration in a user settings.json
file:
{
"[json]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[markdown]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[typescript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode" // disabled in brixtol packages
},
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode" // disabled in brixtol packages
}
}
If you are working within a pnpm monorepo workspace there are 2 ways you can leverage prettier. For us here at brixtol we provide prettier and the shareable config in the root as developement dependency. You may wish to refer a certain workspace (package) to the shareable config within .vscode/settings.json
file:
{
"prettier.configPath": "node_modules/@brixtol/prettier-config/index.js"
}
We do not leverage prettier for various file types because it is extremely opionated and conflicts with our code styles, especially that found in JavaScript and TypeScript based projects. In almost all packages within our monorepo a .prettierignore
file is included to prevent prettier from wreaking utter havoc in our development workspace. Below is standard ignores we assert:
*.toml
*.mjs
*.js
*.ts
*.css
*.scss
*.liquid
*.html
We ♡ open source!