When you’re working on a large project with a team of developers, it is a common practice to agree on a formatting style for the code. However, this is easier said than done. We developers have a tendency to be very opinionated. For example, some people like to give two spaces to a tab, while some give four. Some people start their function definitions from a new line, while others on the same. Well, you get the idea.
Highlights (Page Contents)
“Prettier lets you format your code in a consistent and intelligent way.”
Usage
It’s built by the facebook team and is very easy to download and Install. e.g you can install through npm like this
I love it because It lets you focus on the code and logic, rather than worry about the structure.
My Setup
I love it because It lets you focus on the code and logic, rather than worry about the structure. My current setup is pretty simple, I have integrated prettier with my Visual Studio Code editor. Its available as VS code plugin. I have set the configuration in such a way that whenever I save a document it runs prettier and formats the code.
In Action
Dive Deeper
If you want to understand the thought process and details of this tool. I suggest you have a look at these two videos.