prettier

prettier offers automatic formatters for other file types, including TypeScript, JSON, Vue, YAML, TOML and XML.

Installation

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

Configuration

$ npx prettier --write path/to/my/file.js

Pre-commit hook for prettier

Installation

$ npm install pretty-quick husky --save-dev

Configuration

In the package.json file you can configure the pre-commit hook as follows:

{ "husky": { "hooks": { "pre-commit": "pretty-quick --staged" } } }

See also