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"
},
Answer from Riadh Adrani on Stack Overflowreactjs - Prettier not working on save from within Visual Studio Code - Stack Overflow
Extension 'prettier.prettier-vscode' is configured as formatter but not available. Select a different default formatter to continue.
Prettier does not work as default formatter in VS Code 1.57.1 on Windows.
Should I stop using a code formatter (such as Prettier in VScode)?
Videos
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
I’ve been doing an internship lately, and have been using Prettier code formatter in my editor.
Often when I make just a small change to their code base there ends up being hundreds of other lines which get changed as well due to Prettier.
Then in GitHub, instead of seeing the one small change, there are many changes... even after excluding white space.
I can imagine this would make things more difficult for the code reviewer.
Should I just disable Prettier? Or at least disable things like line-wrapping, etc.?