-
npm install --save-dev @ptsecurity/prettier-config prettier
-
In your project create .prettierrc.js with line:
module.exports = require('@ptsecurity/prettier-config');
Better if prettier and tslint will handle different files especcially if there are custom rules.
This may not work as expected in Webstorm.
-
npm install --save-dev husky lint-staged
-
Add lines to your package.json, select type of files for formatting. As example:
"scripts": {
"precommit": "lint-staged"
},
"lint-staged": {
"linters": {
"*.{js,css,less,md}": ["prettier --write", "git add"]
}
}
- Optionally add plugins depending on the using and priorities your tools.