Install Prettier

Install the "Prettier - Code formatter" extension from the extensions sidebar. Once this is complete, open a code file and press Alt + Shift + F to auto format it. You should see a prompt asking you to choose which code formatter you would like to use since you now have two available. Select Prettier from the prompt.

Enable formatting on save for all files

Open the settings menu via "File > Preferences > Settings". Type editor.formatonsave into the search bar and enable the "Format On Save" setting. Now, whenever you save any file it should be formatted automatically.

Enable formatting on save for only certain file types

Open the settings.json file by navigating to "File > Preferences > Settings" and clicking the "Open Settings (JSON)" button at the top right of the screen.

Search the file for any preexisting "editor.formatOnSave" setting and delete it. Then add the following, replacing "javascript" with whatever language you want to enable format on save for.

"editor.formatOnSave": false,
"[javascript]": {
    "editor.formatOnSave": true
}
Answer from Alex Myers on Stack Overflow
🌐
Prettier
prettier.io › docs › editors
Editor Integration · Prettier
It’s important to install Prettier locally in every project, so each project gets the correct Prettier version. prettier-vscode can be installed using the extension sidebar – it’s called “Prettier - Code formatter.” Check its repository ...
🌐
DEV Community
dev.to › receter › how-to-install-prettier-in-your-codebase-and-vscode-4c19
How to Install Prettier in Your Codebase and VSCode - DEV Community
August 14, 2024 - This is important if you also have prettier installed globally. Now all your project files should be nicely formated. 🧹✨ · Next you can setup a Prettier plugin for your IDE. I use Visual Studio Code, but there are also plugins for many other editors. For VSCode, install this extension: esbenp.prettier-vscode
🌐
Medium
medium.com › @sabirsafder › how-to-configure-prettier-in-vs-code-a-step-by-step-guide-e360ef6a9a2a
How to install & Configure Prettier in VS Code | by Sabir Hussain | Medium
June 10, 2024 - Go to Vscode extensions by clicking on the left-side “extensions” icon in VScode. Search for “prettier” and click on “install”.
🌐
DigitalOcean
digitalocean.com › community › tutorials › how-to-format-code-with-prettier-in-visual-studio-code
Format Code with Prettier in Visual Studio Code: Setup Guide | DigitalOcean
August 1, 2025 - Note: If you do not see a prompt for selecting a default formatter, you can manually set Prettier as the default formatter in VS Code. Open your Settings and set Editor: Default Formatter to esbenp.prettier-vscode.
🌐
GitHub
github.com › prettier › prettier-vscode
GitHub - prettier/prettier-vscode: Visual Studio Code extension for Prettier · GitHub
Visual Studio Code Market Place: Prettier - Code formatter · Can also be installed in VS Code: Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Author   prettier
🌐
Prettier
prettier.io › docs › install
Install · Prettier
See Editor Integration for how to set up your editor. If your editor does not support Prettier, you can instead run Prettier with a file watcher. ... Don’t skip the regular local install! Editor plugins will pick up your local version of Prettier, making sure you use the correct version in every project.
Find elsewhere
🌐
freeCodeCamp
freecodecamp.org › news › how-to-use-prettier-in-visual-studio-code
How To Use Prettier in Visual Studio Code
March 18, 2024 - At the top of the list you will find the Prettier - Code formatter extension. You need to open it, and click the Install button:
🌐
YouTube
youtube.com › watch
Install Prettier on VSCode | Set Up and configure Prettier - Opinionated Code Formatter - YouTube
In this video I have shown how you can install prettier on Visual Studio Code and also configure and setup on React Project. PayPal : https://paypal.me/code...
Published   September 10, 2023
🌐
Robin Wieruch
robinwieruch.de › how-to-use-prettier-vscode
How to use Prettier in VS Code
How to install Prettier for VS Code (Visual Studio Code). Install Prettier, configure it globally to format on save, add further Prettier configuration on a global level, and use a local .prettierrc file ...
🌐
Educative
educative.io › answers › how-to-set-up-prettier-and-automatic-formatting-on-vs-code
How to set up Prettier and automatic formatting on VS Code
Click on the “extension logo” from the left sidebar and type “Prettier” in the search bar. Next, click on the “Install” button.
🌐
Medium
masukmia.medium.com › how-to-install-and-configure-prettier-in-vscode-for-seamless-code-formatting-f7893a771066
How to Install and Configure Prettier in VSCode for Seamless Code Formatting | by Masuk Mia | Medium
October 13, 2024 - Once VSCode is installed, launch it. Click on the Extensions icon located on the sidebar of VSCode or use the shortcut Ctrl+Shift+X (Windows/Linux) or Cmd+Shift+X (Mac). In the search bar, type Prettier — Code formatter.
🌐
Salesforce Developers
developer.salesforce.com › docs › platform › sfvscode-extensions › guide › prettier.html
Prettier Code Formatter | Salesforce Extension Pack Features | Salesforce Extensions for Visual Studio Code | Salesforce Developers
The "trailingComma": "none" setting is required for Aura. After creating the local configuration file, install the Prettier extension for VS Code. If you want to ensure that all your files are formatted whenever you save them, enable the editor.formatOnSave setting in your User and Workspace ...
🌐
MakeUseOf
makeuseof.com › home › programming › how to set up prettier in visual studio code
How to Set Up Prettier in Visual Studio Code
May 5, 2023 - But here's the problem: manual code formatting can be an absolute pain and very prone to error. Tools like Prettier make formatting HTML, CSS, JavaScript, and other languages, so much easier. Discover how to install and use the Prettier extension for code formatting, as well as some advanced configuration settings.
🌐
Fishtank
getfishtank.com › insights › running-prettier-from-the-command-line
Running Prettier from the Command Line | Fishtank
Prettier can be installed through VS Code IDE extensions by searching for “Prettier - code formatter” in visual studio code marketplace and clicking on it. When it is opened, you can review it and click the install button.
🌐
Salesforce Developers
developer.salesforce.com › tools › vscode › en › user-guide › prettier
Prettier Code Formatter | Salesforce for VSCode
The "trailingComma": "none" setting is required for Aura. After creating the local configuration file, install the Prettier extension for VS Code. If you want to ensure that all your files are formatted whenever you save them, enable the editor.formatOnSave setting in your User and Workspace ...
🌐
GitHub
github.com › prettier › prettier-vscode › releases
Releases · prettier/prettier-vscode
Visual Studio Code extension for Prettier. Contribute to prettier/prettier-vscode development by creating an account on GitHub.
Author   prettier
🌐
Alphr
alphr.com › home › how to use prettier in vs code
How To Use Prettier in VS Code
July 18, 2022 - Select the official Prettier extension from the list. Hit the “Install” button.