Prettier is a code formatter that makes your code look neat and consistent. To learn more about Prettier, please visit the website here.
Below is an easy way to set up Prettier on your VS Code and allow automatic formatting.
Click on the extension tab and type in Prettier.
Once found, click on it to proceed to installation.
Once installation is successful, open the settings of your VS Code. You can do this on Windows by pressing both
,. Click on the formatting section of the Text Editor tab and enable Format on Save Mode.
Now, highlight your code and right-click. Select Format Document.
Once you click on Format Document, a dialog box will tell you to configure your code formatter. This is to set your default code formatter. Click on the configure button.
After you click on configure, select Prettier as the default formatter.
And that’s it!
Now, your code should be formatted with Prettier anytime you save your file.
View all Courses