Prettier config

1. Install prettier as dev dependency

npm install --save-dev --save-exact prettier

2. Create prettier config file

File: .prettierrc.json
json

{
   "printWidth": 120,
   "tabWidth": 3,
   "singleQuote": true,
   "insertPragma": true
}

 
If you like to format all project files at once, just create an npm shortcut script.

This snippet will format all .ts files inside /src:

"format-prettier": "prettier --write \"./src/**/*.ts\""

Leave a Reply

Your email address will not be published. Required fields are marked *