Prettier is an opinionated code formatter which will automatically format your code when you save files. Please install a Prettier plugin for whatever editor or IDE you will be using. If you are using VS Code like me, do the following:
- Go to
Code > Preferences > Extensions
. Search for "Prettier". Click "Install" for the top result, which should have the highest download count. You may need to restart VS Code. - Open a
.js
file and save it to test it out. You will likely see that your file was reformatted.
If you aren't using VS Code, check out the Editor Integration page.
Prettier offers some flexibility if you want it to format your code a certain way. For example, you can configure Prettier to use single quotes instead of double quotes. Check out the Configuration page for more information.