Sharable config for Prettier
Install the package
npm install -D @dootrix/prettier-configThen add the following line to your package.json file.
{
"prettier": "@dootrix/prettier-config"
}If you wish to customise options further, remove the pettier
config from package.json and create a prettier file (/.prettierrc.js) with the
following.
module.exports = {
...require('@dootrix/prettier-config'),
tabs: true,
tabWidth: 4,
};Make sure you have Prettier extention installed and add the
following into the project's settings file (/.vscode/settings.json)
(adding/deleting as appropriate).
{
"[typescript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[scss]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[json]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"typescript.format.enable": false,
"editor.formatOnSave": true
}