Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Prettier's format on save messes up .jsx files

I have format on save enabled, and it works fine in .js files but when I try to save code in my .jsx files everything gets messed up. How can I configure my prettier to avoid this problem without disabling format on save?

like image 964
Le garcon Avatar asked May 10 '18 18:05

Le garcon


2 Answers

If you are using VS Code, try adding this to your settings.json file:

{
  "editor.formatOnSave": false,
  "[javascriptreact]": {
      "editor.formatOnSave": true
  }
}
like image 92
Brian Patrick Hummel Avatar answered Oct 07 '22 03:10

Brian Patrick Hummel


for anyone who encounter this, you probably have some other VS Code plugin installed, such as Beautify which is recommended by vscode. Uninstall it and prettier should works now.

like image 11
fengd Avatar answered Oct 07 '22 02:10

fengd