@thunder-tools/prettier-plugin-formatter
v1.1.1
Published
A prettier formatter plugin, supporting to sort and remove unused imports
Downloads
109
Readme
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 @thunder-tools/prettier-plugin-formatter
Usage with Visual Studio Code
Install Prettier extension for vscode:
esbenp.prettier-vscode
To apply auto format on save for vscode, you must create ".vscode > settings.json" with properties:
"[typescript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"editor.formatOnSave": true
Then restart vscode
Usage with prettier cli
You can format ts imports using prettier cli, the example command line:
yarn prettier src\app\app.component.ts
Usage with lint-staged, pretty-quick
The tool can also format staged files before committing by GIT.
Firstly, we install the needed libraries.
yarn add -D lint-staged pretty-quick
Then we register this code to package.json
"lint-staged": {
"*.{ts,tsx,js,jsx,json,scss,md}": [
"pretty-quick --staged",
"git add -f"
]
},