Formatting of JavaScript in the <script> block is broken with the release of Prettier 1.13.0. Format Document does not make any corrections.
In contrast, the <style> block is being formatted as expected.
Installing Prettier 1.12.1 in the project and reloading VSCode fixes the issue:
npm install -D -E [email protected]
vue init webpack-simple and accepting the defaults.<script> block.<script> block.I have the same problem,so I changed the setting
"vetur.format.defaultFormatter.js": "vscode-typescript"
it works well.
I'm having the same issue. The following error is shown in the vue language server output log:
prettier-eslint [ERROR]:
Prettier-Eslint format failed
[Error - 12:17:56] No parser could be inferred for file: **the path to the local file**
Changing the default formatter to typescript like @lesonky suggested didn't fix.
@zavarka @lesonky @patrickcate I cannot reproduce it though. I'm on prettier 1.13.4 and it works fine for me. Can you still repro on 1.13.4 or is it only 1.13.0?
Seems this is a prettier issue: https://github.com/prettier/prettier/commit/1350edc5a65bded15b9dfc27d5e2a0706d9d1fe1
It has been addressed since 1.13.1.
@octref Thanks for taking a look! I'm still able to reproduce the problem with [email protected], and downgrading to [email protected] still fixes it.
I don't have prettier installed globally. Only in the specific project.
@zavarka For this project https://github.com/octref/veturpack
If you clone it and run yarn add -D [email protected]. This still happens to you?
@octref Yes, the same issue occurs with the project https://github.com/octref/veturpack. Initially, the formatting works, but after running yarn add -D [email protected] it no longer works.
@octref I upgraded the Prettier VSCode extension, which now uses [email protected], and I'm still running into the same error as well.
I have the same problem!
I will get the following error when formatting if I set prettier.eslintIntegration to true.
Prettier-Eslint format failed
[Error - 16:24:40] No parser could be inferred for file: ...
VSCode version: 1.24.1
Vetur version: 0.12.5
Prettier plugin version: 1.5.0
I had to set prettier.eslintIntegration to false to make formatting work.
@octref Maybe you should reopen this issues.
Since v1.13.x, Pettier make a breaking change. And prettier/prettier@1350edc didn't fix it, just trigger a warning.
When I install Pettier 1.13.x, VLS output No parser could be inferred for file.
@Airkro We bundle prettier 1.11.1. How are you updating?
@octref Sorry, I mean install it in my project root, just yarn add -D prettier
@Airkro Thanks, will track it in #835.
Most helpful comment
I have the same problem,so I changed the setting
it works well.