Over the years everyone will develop their own beauty routines when it comes to their individual coding.
While it’s easy to become attached to how you like to format your code, in a team environment it’s really important to share the mirror with teammates.
Having an agreed set of standards on how the code will be formatted goes a long way to improve its legibility. If one person is using tabs, and another spaces, then things can get ugly fairly quickly. Of course, this sort of formatting can be done manually, but we’re not wild animals so we can just get the computer to do most of the work for us.
Most text editors have multiple plugin options to take care of this sort of thing. There’s even a standard called editorconfig that allows different developers to work on different projects, even using different editors. Using the editorconfig standard a developer can automatically conform to whatever the standard is for a particular project without much of a song and dance.
The two most popular beautifying plugins are:
- Prettier – https://prettier.io
- Beautify – https://marketplace.visualstudio.com/items?itemName=HookyQR.beautify
Believe it or not, you can actually use both of these at the same time. There are some good details as to the how’s and why’s of that on CSS-Tricks.com