Prettier doesn't format .tsx file Prettier doesn't format .tsx file typescript typescript

Prettier doesn't format .tsx file


edit setting with following in settings.json of VScode

"[typescriptreact]": {    "editor.defaultFormatter": "esbenp.prettier-vscode"},


Expanding on iNeelPatel's answer, I had to add two lines to VSCode JSON settings:

"[typescript]": { "editor.defaultFormatter": "esbenp.prettier-vscode" },"[typescriptreact]": { "editor.defaultFormatter": "esbenp.prettier-vscode" }


This will give perfect solution

"Same thing happened to me just now. I set prettier as the Default Formatter in Settings and it started working again. My Default Formatter was null."

https://github.com/microsoft/vscode/issues/108447#issuecomment-706642248