I’m going to walk you through exactly how I got Prettier working in VS Code. Took me maybe 5 minutes total.
First things first – get the extension:
Open up VS Code (obviously). Then look for that little blocks icon on the left side – that’s your Extensions panel. Click it, or just press Ctrl+Shift+X if you’re into keyboard shortcuts.
Now search for “Prettier – Code Formatter” and hit enter. You’ll see it at the top of the results – it’s got like 20 million downloads or something crazy like that. Click “Install” and you’re halfway done.
Next up – make it work for you:
Here’s where most tutorials get boring, but stick with me. You need to configure this thing or it might not match your style.
Hit Ctrl+, to open settings (or go File > Preferences > Settings if you’re old school). Search for “Prettier” and you’ll see all the options.
The settings I actually care about:
- Tab width: I use 2 spaces because that’s what my team decided after a very heated Slack discussion
- Semicolons: I keep them on because old habits die hard
- Quote style: Single quotes, because double quotes feel too formal for JavaScript
Pro tip: Don’t overthink these settings. Pick what feels right and move on. You can always change them later.