Update, i just find the solution if anyone is having the same problem i have to add the following lines to user setting json

"editor.defaultFormatter": "esbenp.prettier-vscode",
  "[javascript]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode"
  }
Answer from Diegohp141 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 - To open the command palette, press Command + Shift + P on macOS or Ctrl + Shift + P on Windows. In the command palette, search for format and then choose Format Document. You may then be prompted to choose a formatter. Click the Configure button: Then, select Prettier – Code Formatter.
🌐
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 - Your code gets fixed before it ever leaves your machine, so you […] ... What fixed it for me was ctr + shift + p and i search format document with and gives me the option and when i navigate to configure default formatter i select prettier ...
🌐
Robin Wieruch
robinwieruch.de › how-to-use-prettier-vscode
How to use Prettier in VS Code
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.
🌐
freeCodeCamp
freecodecamp.org › news › how-to-use-prettier-in-visual-studio-code
How To Use Prettier in Visual Studio Code
March 18, 2024 - The code could formatted in a better way, right? Here's where Prettier comes into play. To format code, we need to open the command palette – you can use COMMAND + SHIFT + P on macOS or CTRL + SHIFT + P on Windows and Linux.
Find elsewhere
🌐
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
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.

🌐
HumanKode
humankode.com › javascript › set-up-prettier-and-vs-code-to-format-your-code
Set up Prettier and VS Code to Format Your Code
March 28, 2025 - Then add the following lines to the settings.json file and save it. ... Reload VS Code by entering the keyboard shortcut CMD + Shift + P on Mac or Ctrl + Shift + P on Windows, then type in reload, and select Developer: Reload Window. Select Developer: Reload Window from the Command Palette · If you'd like to be able to run npm scripts to check and fix formatting for all your files in your project, do the following: ... "scripts": { "prettier": "prettier --check '**/**/*.{js,jsx,ts,tsx,css}'", "prettier:fix": "prettier --write '**/**/*.{js,jsx,ts,tsx,css}'" }
🌐
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 - Press Ctrl+, (Windows/Linux) or Cmd+, (Mac) to open Settings. In the search bar, type default formatter. Under Editor: Default Formatter, select Prettier — Code formatter from the dropdown menu. Enable Editor: Format On Save by checking the box.
🌐
JustAnswer
justanswer.com › computer › rd8ph-want-set-extension-prettier-vs-code-save.html
How to Set Prettier as VS Code Save Formatter?
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 ...
🌐
JSDev
jsdev.space › speedup-prettier
5 Proven Ways to Speed Up Prettier Format-On-Save in VS Code
Activate Extension Bisect: Press Cmd+Shift+P (Mac) or Ctrl+Shift+P (Windows/Linux) and type “Start Extension Bisect.” VS Code will begin disabling half of your extensions. Reproduce the Issue: Test Prettier’s format-on-save functionality.
🌐
Alphr
alphr.com › home › how to use prettier in vs code
How To Use Prettier in VS Code
July 18, 2022 - This process will also work on your CSS files. Open the VS Code Settings menu by tapping “Command + ,(comma)” if you use a Mac. Click on “Control + ,(comma)”, if you are a Windows user.
🌐
YouTube
youtube.com › watch
Are you using Prettier? (how to set up in VSCode to format on save) - YouTube
Enjoy the videos and music you love, upload original content, and share it all with friends, family, and the world on YouTube.
Published   December 11, 2022
🌐
Codereadability
codereadability.com › automated-code-formatting-with-prettier
Automated code formatting with Prettier
May 10, 2018 - There are Prettier plugins for many different editors available. Here I'll show the setup in Visual Studio Code. ... Open the Command Palette (under the View submenu, or using Cmd+Shift+P on Mac and Ctrl+Shift+P on Windows).
🌐
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....
🌐
Matthewseiwert
matthewseiwert.com › code › html › auto-format-code-vscode-prettier
Auto Format Code in Visual Studio Code Using Prettier
Thankfully there is a way to automatically format your code with the Prettier extension. With Prettier you can either format with a shortcut (Shift Option F on Mac) or set up automatic format on every file save.