π― Purpose of This Note
A quick overview of a recommended VS Code extension setup, followed by a step-by-step guide to installing and configuring Prettier β a code formatter that will be used throughout the rest of the course.
π§© VS Code Extensions Overview
π¦ Below are the extensions mentioned, with brief explanations of what each does:
π§© Extension | π― Purpose |
|---|---|
| π± Highlights environment variables inside |
ESLint | π‘οΈ Detects bugs and enforces code-quality rules in JavaScript (will be set up with Node in a later section) |
Image Preview | πΌοΈ Shows a small thumbnail preview of image files directly in the file explorer/sidebar |
Prettier | β¨ Automatically formats code (JavaScript, CSS, HTML, etc.) β covered in detail below |
Pug Beautify | π Formats Pug template files (Pug is a templating language used later in the course) |
TabNine | π€ An AI-powered autocomplete tool that helps speed up coding |
TODO Highlight | π Highlights special comment keywords in different colors for visibility |
Oceanic Next (Theme) | π¨ The color theme used throughout the course (mentioned since it's a commonly asked question) |
π¦ TODO Highlight in Action
π This extension colors specific keywords written in code comments:
β
TODOβ highlighted in green.π
BUGβ highlighted in red.π§
FIXMEβ highlighted in another distinct color.

π These highlighted lines also show up as colored markers in the scrollbar, making it easy to spot important notes across a long file at a glance.
βοΈ Setting Up Prettier
π€ What Prettier Does
β¨ Automatically formats your code (JavaScript, CSS, HTML, etc.) to a consistent, opinionated style.
π§Ή Handles indentation, quote style, line breaks, semicolons, etc. β no manual formatting needed.
π€ Intentionally has few config options β a feature, not a limitation, since it keeps formatting consistent and out of debate, especially on teams.
π₯ Step 1: Install the Prettier Extension
π Search for "Prettier" in the VS Code Extensions panel and click Install.

πΎ Step 2: Enable "Format on Save"
βοΈ Open VS Code Settings.
π Search for:
Format on Save.β Enable the checkbox.
πΎ Now, every time you save a file, Prettier will automatically reformat it according to its rules.
π Step 3: Create a Prettier Configuration File
π Instead of configuring Prettier through VS Code's settings UI, create a dedicated config file in your project's root folder:
.prettierrc
π€ Why Use a Config File Instead of VS Code Settings?
Settings inside a
.prettierrcfile are project-specific and can travel with the codebase.This makes it easy to:
π Use different formatting rules across different projects.
π₯ Ensure all developers on a team use the exact same formatting rules (very useful for collaborative projects).
π Example Configuration
{
"singleQuote": true
}
"singleQuote": truetells Prettier to convert all double quotes (") to single quotes (') throughout your code.The default value for
singleQuoteisfalse(meaning Prettier normally prefers double quotes unless told otherwise).
π§ͺ Step 4: Testing Prettier in Action
After saving .prettierrc, save any JavaScript file (e.g., index.js) and watch for:
π€ Quotes converted β double quotes automatically switch to single.
π§Ή Extra blank lines collapsed β Prettier allows only one blank line between code blocks.
β οΈ Not configurable β one of the few restrictive parts of an otherwise well-liked tool.
π Long lines wrapped β lines past a character limit get intelligently broken up.
π Semicolons added back β delete them and save, Prettier restores them.
βοΈ Step 5: More Prettier Options
Search "Prettier" to see its full option list on the official site (described as an "opinionated code formatter" with intentionally few settings), including:
βοΈ Option | π― Controls |
|---|---|
| π Max line length before wrapping (default: 80) |
| βοΈ Spaces per indentation level (default: 2) |
| π€ Single quotes vs. double quotes (default: false) |
π― Key Takeaways
π Concept | π‘ Detail |
|---|---|
β¨ Prettier | An opinionated code formatter for JS, CSS, HTML, etc. |
πΎ Format on Save | VS Code setting that triggers Prettier automatically every time you save a file |
π | Project-level configuration file for Prettier settings β better than VS Code UI settings for consistency across a team |
π€ | Converts double quotes to single quotes throughout your code |
π | Controls the max line length before wrapping (default: 80) |
βοΈ | Controls indentation spacing (default: 2) β not the same as |
π« Not fully configurable | Prettier intentionally limits customization (e.g., you can't allow multiple blank lines) to keep formatting consistent |
π Wrap-Up
π This Notes concludes the Node Farm project and the introductory Node.js section.
π From this point forward in the course, all code will be automatically formatted using this Prettier +
.prettierrc(singleQuote: true) setup with Format on Save enabled.