Why Prettier does not format code in VSCODE?

后端 未结 18 597
失恋的感觉
失恋的感觉 2020-12-07 18:39

In my Nuxt application where ESlint and Prettier are installed and enabled, I switched to Visual Studio Code editor.

When I open a .vue file and pre

相关标签:
18条回答
  • 2020-12-07 18:48

    1 .Use the other extension prettier was not working for me i just use the other VSCODE extension named PrettierNow i think this will help, done for me.Checkout the extension here

    2 .From Latest Updates of prettier you need to add .prettierrc file in your root of the projects if you want to stick with prettier. An example of .prettierrc is this-

    {
      "tabWidth": 4,
      "singleQuote": true,
      "semi": false
    }
    
    0 讨论(0)
  • 2020-12-07 18:48

    I Rolling back prettier to 1.7.3 and fixed it

    0 讨论(0)
  • 2020-12-07 18:50

    Some times with auto plugins update Required files used by Prettier might go missing .

    Check this path if files are present here or folder is empty

    C:\Users\YOURUSERNAME\.vscode\extensions\esbenp.prettier-vscode-2.2.2\out

    If missing uninstall and reinstall prettier

    0 讨论(0)
  • 2020-12-07 18:50

    Go to Manage(located on left-bottom corner) -> Settings -> Users tab -> Text-Editor -> Formatting -> check the format on save

    if not working then close and again open your vscode editor

    0 讨论(0)
  • 2020-12-07 18:52

    I faced this problem and these three steps solved my problem:

    0 讨论(0)
  • 2020-12-07 18:53

    Recently I got the same problem, that Prettier does not format code automatically on saving. Checking Prettier, I saw an error: Invalid "arrowParens" value. Expected "always" or "avoid", but received true.

    The error message was seen when I clicked this:

    It turned out that I have Prettier Now installed also. This has a boolean value in my config file. After uninstalling Prettier Now, everything works fine.

    0 讨论(0)
提交回复
热议问题