@thunder-tools/prettier-plugin-formatter
TypeScript icon, indicating that this package has built-in type declarations

1.1.1 • Public • Published

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"
  ]
},

Readme

Keywords

none

Package Sidebar

Install

npm i @thunder-tools/prettier-plugin-formatter

Weekly Downloads

81

Version

1.1.1

License

MIT

Unpacked Size

83.1 kB

Total Files

33

Last publish

Collaborators

  • thunder-tools