An Angular Cli project uses TSLint for 'linting', so we can leave the code-quality rules for TSLint to handle, and we can have Prettier take care of formatting rules
Add prettier to your project:
npm install prettier -D
Create .prettierrc
: regardless of what editor your team members use, they will all reference the same configuration file:
{
“printWidth”: 120, //default is 80
“singleQuote”: true, //enforce single quotes instead of double
“useTabs”: false,
“tabWidth”: 2,
“semi”: true,
“bracketSpacing”: true
}
Install VSCode Prettier Extension and in vscode settings:
“editor.formatOnSave”: true
(este paso a mi no me hace falta)
Remove formatting rules from tslint.json
: we want to remove the code formatting rules from TSLint and let Prettier handle that:
https://gist.github.com/victormejia/8a97cddc6d43078eee3a50b463fb85f9#file-tslint-diff-md