- Select
File -> Preferences -> Settings(Ctrl+comma) and search formformatter - 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
Recently joined a agency as an Contract React developer. I was assigned a task to edit some inline Scss code.
Being a Prettier user I formatted the code, made the necessary changes and submitted a pull request.
Next day the senior developer reviewed my code and asked me to stop using Prettier and assigned me a task to change back the Scss code manually to inline Scss.
When I asked why should I not use prettier to format code. He said it's bad and time consuming and other team members started telling me a story how one time prettier wasn't working and started throwing errors.
That's why they never use it.
I wanted to say that It was showing error because you were doing something wrong.
Just because you once had an bad experience doesn't mean it's bad.
Plus they use one big single Scss file for the whole project.
When I question it too and asked them to use separate files and how it can effect the performance.
One team member answered it doesn't matter, how they don't care about the performance and I should be open minded and learn from them. The boss has 18 years of experience.
What should I learn why not to follow good practices!
Why does Prettier not format code in VS Code?
VS Code - Prettier is formatting differently for me than others - Stack Overflow
reactjs - Prettier not working on save from within Visual Studio Code - Stack Overflow
visual studio code - How to force prettier html formatting to format tags in one line? - Stack Overflow
Videos
» npm install prettier-format
- Select
File -> Preferences -> Settings(Ctrl+comma) and search formformatter - 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
If doing what @Simin Maleki mentioned does not solve it for you, there is a chance that your default formatter is not set:
File > Preferences > Settings > Search for "default formatter"
Make sure your Editor: Default Formatter field is not null but rather Prettier - Code formatter (esbenp.prettier-vscode) and that all the languages below are ticked. This fixed my issue.
STEP BY STEP WALKTHROUGH

Also make sure that your format on save is enabled:

I think there is a bug with the prettier extension. Although I had my default formatter set to the prettier extension in the settings UI, I had to re do it manually.
Open any file, right click in the editor screen, click Format document with and choose Prettier - Code formatter.
The local prettier config and the one vscode uses should work now
I faced the same isssue.
in my case I run
npx prettier --version
on both computer and each one return different prettier version.
so although the prettier extension in vscode was 9.5.0 for both pcs. the npm module installed for the project in node_modules was different.
I installed the same prettier module for both computer and the restart vscode and problem solved
In VSCode, hit CTRL + SHIFT + P, write Preferences: Open User Settings (JSON) and hit enter, it will open up your settings.json:
Make sure prettier is your default formatter:
"editor.defaultFormatter": "esbenp.prettier-vscode"
you can set it for specific languages e.g: for typescript:
"[typescript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
TLDR; Settings > Prettier Require Config: false / unchecked
I tried these and it still wasn't working. I noticed that at the bottom of my VS Code my Prettier wasn't showing a checkmark next to it. Clicked on "Prettier" at the bottom of the screen and it said it was skipping the file because there was not a require config set to true.
Solution was in this thread here: Prettier extension is not working in vs code Require config set to true
Prettier has the option printWidth. If you set that option to a high number, it will break fewer lines.
In your .prettierrc.json file, you can override this option for your HTML files:
{
// Other options...
"overrides": [
{
// change .html with .vue if you are using Vue files instead of HTML
"files": "src/**/*.html",
"options": {
"printWidth": 140
}
}
]
}
Is not recommendable to use a line-lenght higher than 140. Prettier is opitionated, so it should be used without too many customizations.
Check if you have a .prettierrc file in the root directory. If you don't, create it and then put the following in there:
{
"trailingComma": "es5",
"tabWidth": 2,
"useTabs": false,
"singleQuote": true,
"printWidth": 300,
"bracketSpacing": true
}
Set printWidth to some large value and toggle text-wrapping in your editor whenever you want. For example, with Alt+Z in VS Code
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"
}
Press Ctrl+shift+p and type Preferences: Open User Settings (JSON). In that json file add the following line and save. This should enable so vscode formats the code each time you save.
{
"editor.formatOnSave": true
}