Prettier is a tool used by developers to check and fix the format of their code. It is an essential tool that you must use to write readable code with consistent formatting.
Prettier transforms ugly code like this:
<html>
<head>
<title>Prettier</title>
</head>
<body>
<h1>Hello from prettier</h1>
</body>
</html>
into readable code like this:
<html>
<head>
<title>Prettier</title>
</head>
<body>
<h1>Hello from prettier</h1>
</body>
</html>
hence the name: Prettier.
How to use Prettier #
Prettier is a very popular tool and its supported by most of the code editor.
- If you are using VSCode, you can install the Prettier Extension.
- If you are using vim, you can install vim-prettier plugin or using ALE.
Here is the list of supported code editors and the plugin/extension that you can install in order to use Prettier.
| Code editor | Plugin/Extension |
|---|---|
| Visual Studio Code | Prettier - Code Formatter |
| VIM | vim-prettier, ALE & coc-prettier |
| Sublime Text | JsPrettier |
| Visual Studio | Prettier Extension |
| Atom | prettier-atom |
| Emacs | prettier-emacs |
| Espresso | espresso-prettier |
Prettier is used by more than 4 million repositories on github alone, that's very huge number of repositories!