Install Code Formatter “Prettier” on VSCode

10/10/2020Visual Studio CodeVSCode

What is “Prettier"

Prettier is a code formatter and can work on Visual Studio Code as an extension.

By using this tool, your code is automatically formatted when you save it.

How to install Prettier on VSCode.

You can install it on [File] > [Preferences] > [Extensions].


Search “Prettier". Then install it.


Configuration of the .prettierrc file.

Create a .prettierrc under your project directory and edit it.

Example of “.prettierrc" file.

{
  "printWidth": 100,
  "semi": true,
  "singleQuote": true,
  "tabWidth": 2
}


If Your Prettier Doesn’t Work…

Please check Default Formatter setting.