5

Having a problem with Prettier not being able to format. I have format on save selected, the default format is set to use Prettier. Was working fine yesterday and now it is not formatting on save or when I run the format document command. No settings were changed, I did try uninstalling and reinstalling prettier. Force format document also returns an error.

Error

Setting Page 1

Setting Page 2

Version Installed

Force Format Error

Blake
  • 186
  • 1
  • 12
  • Does this answer your question? [Prettier VSCode JSON Format Error - SyntaxError: ';' expected](https://stackoverflow.com/questions/59664360/prettier-vscode-json-format-error-syntaxerror-expected) – JΛYDΞV Jun 23 '21 at 04:02
  • @JayDev No it does not, I have already found the solution – Blake Jun 23 '21 at 17:22
  • 1
    I am using v8.1 and still experiencing this in some files. – Elias Zamaria Sep 09 '21 at 17:59

3 Answers3

4

v8.0 seems to be broken, the solution was to downgrade to v7.1.1.

Found out there were issues here: https://github.com/prettier/prettier-vscode/issues/2029

EDIT: v8.1 is out and the issue is now fixed.

Blake
  • 186
  • 1
  • 12
2

In my case, it was because the prettier setting Prettier:enable was not turned on after the extension installed (finally found this after some time wondering why...).

To check go to File->preferences->settings and then type prettier and scroll down until you see Prettier:enable and make sure it is checked.

(In case you wonder, I figured this out when I look at the output of the prettier console)

Prettier Setting

Elsen Yacub
  • 31
  • 1
  • 4
0

You are probably using v8.0 of the Prettier extension for VS Code. Updating the extension to v8.1, where the issue is fixed, will solve your problem:

  • Find the "Prettier - Code Formatter" extension in your list of extensions in VS Code.
  • Press the "Update" button next to the extension.

Some people have had issues just updating, so alternatively you can uninstall then reinstall the Prettier extension.

Beatso
  • 75
  • 1
  • 9