1. Select File -> Preferences -> Settings (Ctrl + comma) and search form formatter
  2. Set Prettiers as Default formatter.

If above does not work:

ctrl+shift+p > Format Document With... > Configure Default Formatter... > Prettier - Code formatter

This also work with ctrl+shift+I

Answer from Miha on Stack Overflow
🌐
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 - Prettier Can Be Run Manually or Automatically on Save: With the Format Document command or by enabling Format On Save, you can ensure that your code is always formatted cleanly with minimal effort. You Can Customize Prettier to Match Your Preferences: Settings such as quote style, semicolon ...
🌐
Scott Sauber
scottsauber.com › 2017 › 06 › 10 › prettier-format-on-save-never-worry-about-formatting-javascript-again
Prettier + Format On Save = Never worry about formatting JavaScript again – Scott Sauber
June 12, 2021 - I find when using Prettier, along with the Format On Save option in VS Code, I don’t think about how to format my code anymore. I don’t ever wonder “oh should I put this on multiple lines or keep it all in one line?” Instead, I focus on solving my problem, hit Save and let Prettier do the rest.
Discussions

prettier - problems with code formatting on save in vscode - Stack Overflow
I have vscode installed and also the prettier extension. In settings I select the option format on save. However, when saving the formatting of the code does not happen, I have to activate the format More on stackoverflow.com
🌐 stackoverflow.com
I have done all kinds of things but my prettier does not format on save.
Type: Bug I installed prettier, on user I checked format on save and checked the config. Well it does not format on save I have followed all kinds of videos but it doesnot work. I think I did somet... More on github.com
🌐 github.com
3
April 26, 2024
Does Prettier work with autosave?
Well there’s some things you need to consider: first have the config in your config file to use prettier and to format on save. Then you also need to install it as a devdependency and have a config file for it to work. Also you can add a global default prettier config but I would say that’s a bad habit cause you’ll probably forget to add the proper settings in your project More on reddit.com
🌐 r/vscode
7
5
June 4, 2024
Setting up Auto Format on Save easily in VS Code (Visual Studio Code) for Expo React-Native - Stack Overflow
Go to the VSCode settings to set both the User and Workspace fields for a) Editor: Default Formatter to "Prettier - Code formatter", then b) check to enable Format on Save (I also checked Notebook > Format on Save). More on stackoverflow.com
🌐 stackoverflow.com
🌐
Robin Wieruch
robinwieruch.de › how-to-use-prettier-vscode
How to use Prettier in VS Code
February 14, 2022 - We will start by installing the Prettier extension for VS Code. Once you have installed it, you can use it with CTRL + CMD + P (MacOS) or CTRL + Shift + P (Windows) to manually format a file or a selection of code.
🌐
Yogesh Chavan
blog.yogeshchavan.dev › automatically-format-code-on-file-save-in-visual-studio-code-using-prettier
Automatically Format Code On File Save in Visual Studio Code Using Pre
November 5, 2021 - ... To automatically format the file on save, In Visual Studio Code, press Control + Shift + P or Command + Shift + P (Mac) to open the command palette and type setting and then select Preferences: Open User Settings option.
🌐
Medium
medium.com › @kiran.jasvanee › prettier-auto-formatting-in-visual-studio-code-beab1c026b13
Prettier Auto Formatting in Visual Studio Code. | by Kiran Jasvanee | Medium
March 22, 2020 - ... Select — Preferences: Open Workspace Settings, it will come up with a new tab called Settings. In the Workspace section, select Text Editor and select Formatting. Check Format on Save, the second option in Formatting and we are done here.
Find elsewhere
🌐
YouTube
youtube.com › zach gollwitzer
Are you using Prettier? (how to set up in VSCode to format on save) - YouTube
AboutPressCopyrightContact usCreatorsAdvertiseDevelopersTermsPrivacyPolicy & SafetyHow YouTube worksTest new featuresNFL Sunday Ticket · © 2024 Google LLC
Published   December 11, 2022
Views   109K
🌐
GitHub
github.com › prettier › prettier-vscode › issues › 3382
I have done all kinds of things but my prettier does not format on save. · Issue #3382 · prettier/prettier-vscode
April 26, 2024 - Type: Bug I installed prettier, on user I checked format on save and checked the config. Well it does not format on save I have followed all kinds of videos but it doesnot work. I think I did something wrong with the path. I even tried t...
Published   Apr 26, 2024
🌐
Medium
medium.com › @glen.gracieux › auto-formatting-on-vs-code-using-prettier-extension-743b88f1539d
Auto formatting on VS Code using Prettier extension. - Glen Paulson - Medium
August 26, 2023 - Step 1 → Open VS Code → Navigate to Extensions → Search for Prettier → Install the extension. Press enter or click to view image in full size · Step 2 → Go to settings (bottom left corner settings ⚙️ icon) Press enter or click ...
🌐
DEV Community
dev.to › drunckj › setting-up-code-formatting-with-eslint-typescript-and-prettier-in-visual-studio-code-44an
Setting up Code Formatting with ESLint, TypeScript, and Prettier in Visual Studio Code - DEV Community
October 25, 2023 - Format on auto save : This extension enables code formatting on auto-save. You can configure Visual Studio Code for auto-formatting by following these steps: Open your command palette (Command + Shift + P) or Ctrl+Shift+P. Look for "Preferences: ...
Top answer
1 of 3
7

I'm more of the "edit the JSON" type of user of VSCode, and the answer from Masud was confusing to me because of that. It did push me in the right direction and I want to share for other like myself, more familiar with the .vscode/settings.json(s) than with that graphical Settings Editor.

settings.json edits - add these:

{
  "editor.defaultFormatter": "esbenp.prettier-vscode",
  "editor.formatOnSave": true
}

.prettierrc edit or add a file by that name at the root of your project for any custom settings. Here are some of my favs:

{
  "singleQuote": true,
  "tabWidth": 2,
  "trailingComma": "none"
}

Then, you can sanity check against those rules. I just added a trailing comma in an object block (in a Styles block in the sample Expo tsx component, in my case - brand new project) and see it removed on save... Then, remove the trailingComma rule, save, and try the comma again and see that the comma stays.

2 of 3
4

Regarding Auto Code Formatting:

For anyone starting out with VSCode - Expo, React-Native devs or having some issues with code formatting, please find below the simplest solution I could find (ESLint is a bit confusing / complex unless you are fairly familiar) - link to Expo guide is here if you would really like to do this (https://docs.expo.dev/guides/using-eslint/) - It is a bit complicated if you are just starting out and I find ESLint to cause too much bloat messaging on my code editor screen, especially now that there are things such as copilot etc.


[Instructions] Simply set up Prettier (no ESLint):

  1. Add 'Prettier - Code Formatter' extension in VSCode and enable it
  2. Go to the VSCode settings to set both the User and Workspace fields for a) Editor: Default Formatter to "Prettier - Code formatter", then b) check to enable Format on Save (I also checked Notebook > Format on Save).

Now get to Coding!!!


Some Next Steps:

You can check out the Expo Guide (or similar) for further best practices but it will take some time to get it all setup.

Prettier should already auto-format on save and you can further configure it by adding a .prettierrc file at the root of your project and following https://github.com/expo/expo/tree/main/packages/eslint-config-universe#customizing-prettier which should override the default settings you have set up for all your projects.

You can later setup linting as well which is generally more useful down the line for when working with remote/shared repositories (ie: they contain explanations for the correction, etc.). Causes a bit of bloat but it's quite helpful for navigating a new team / codebase (ex Amazon SDE) to understand the style guidelines being used, fixing an entire project programmatically via a script etc. with ESLint.

🌐
JSDev
jsdev.space › speedup-prettier
5 Proven Ways to Speed Up Prettier Format-On-Save in VS Code
November 5, 2024 - Consider Using prettier-eslint: If you’re using ESLint, integrate it with Prettier to avoid double processing: ... Format Selected Files Only: Instead of formatting the entire project, use VS Code’s file explorer to selectively format files or directories. Use Git Pre-commit Hooks: Move formatting to pre-commit hooks using husky and pretty-quick: npm install —save-dev husky pretty-quick Add to your package.json:
🌐
Visual Studio Marketplace
marketplace.visualstudio.com › items
Prettier - Code formatter - Visual Studio Marketplace
January 21, 2026 - Extension for Visual Studio Code - Code formatter using prettier
🌐
Gleb Bahmutov
glebbahmutov.com › blog › configure-prettier-in-vscode
How to configure Prettier and VSCode | Better world by better software
April 23, 2024 - Using it from a script in package.json ... code does not change. This could be due to three issues: Make sure local workspace settings have auto-format on save enabled....
🌐
JustAnswer
justanswer.com › computer › rd8ph-want-set-extension-prettier-vs-code-save.html
How to Set Prettier as VS Code Save Formatter?
February 24, 2025 - To set Prettier as your default formatter in VS Code, open Settings (Ctrl+,), search for 'default formatter,' and select 'Prettier - Code formatter.' Then enable 'Format On Save' by searching for 'format on save' and checking the box. Ensure ...
🌐
Khalil Stemmler
khalilstemmler.com › blogs › tooling › prettier
How to use Prettier with ESLint and TypeScript in VSCode | Khalil Stemmler
January 21, 2022 - One of the most common ways that people use Prettier is to install the VS Code extension that adds it to your editor. It enables you to, on save, format your code.
🌐
Reddit
reddit.com › r/javascript › [askjs] autoformatting issue with prettier and vscode
r/javascript on Reddit: [AskJS] Autoformatting issue with prettier and vscode
March 28, 2025 -

Hello, I am banging my head against a wall.

For long I had no autoformatting enabled in Vscode, when eslint (or prettier - I use the eslint prettier package) complained about some styling formatting I hovered over the error and clicked "Fix all problems" in Vscode.

But then I thought I finally need to setup the fix/format on save thingy… I enabled format on save in vscode settings And added this in my settings json in my project:

"editor.formatOnSave": true, "editor.codeActionsOnSave": { "source.fixAll.eslint": true },

And it works!

But it seems I have some conflicting rules or stuff. Because I have something like this: some function => {} and when I hit save it formats to add a whitespace inside the curly braces: some function => { }

And here begins my problem. With the space I get an eslint error to remove the whitespace but when saving it adds it again. I am basically stuck lol

I tried to revert the settings in vscode but it keeps happening and I have no idea where to look for to fix this issue?

I will really appreciate any help or hints.

🌐
Reddit
reddit.com › r/vscode › how to stop vscode/prettier to stop formatting these to the same line on save?
r/vscode on Reddit: How to stop VSCode/prettier to stop formatting these to the same line on save?
January 24, 2025 - using eslint as a as formatter is ... against the world in that ... with that said, so worth it ... if you and your other users enjoy the output. the prettier ignore next line comment however should work. Does anyone know why VsCode keep giving me this glowing effects and how to get rid of it?