1.0.1 • Published 4 years ago
@eztool/prettier-plugin-formatter v1.0.1
A prettier formatter plugin, supporting to sort and remove unused imports.
This plugin can work well with vscode, prettier cli and pretty-quick.
Installation
yarn add -D @eztool/prettier-plugin-formatter
Visual Studio Code
Install Prettier extension in vscode:
esbenp.prettier-vscode
Setting up ".vscode > settings.json" with properties:
"[typescript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"editor.formatOnSave": true
Then restart vscode
Prettier CLI
You can format ts imports using prettier cli, the example command line:
yarn prettier src\app\app.component.ts
Use with pre-commit tools such as lint-staged, pretty-quick
The tool can also format staged files before committing by GIT.
Install the libraries.
yarn add -D lint-staged pretty-quick
Update the package.json
"lint-staged": {
"*.{ts,tsx,js,jsx,json,scss,md}": [
"pretty-quick --staged",
"git add -f"
]
},
1.0.1
4 years ago