question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Incompatible with Prettier 2.0 because of parser option babylon which has been removed (replaced by babel)

See original GitHub issue
  • I have searched through existing issues
  • I have read through docs
  • I have read FAQ

Info

  • Platform: Win
  • Vetur version: 0.24.0
  • VS Code version:

Problem

The parser option babylon has been removed in Prettier 2.0

Error message:

Prettier format failed [Error - 10:52:04 p.m.] Couldn’t resolve parser “babylon”

The fix: https://github.com/vuejs/vetur/blob/master/server/src/modes/script/javascript.ts#L484 Replace babylon with babel

Reproducible Case

Format a Vue File using prettier 2.0

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:8
  • Comments:8

github_iconTop GitHub Comments

3reactions
Janthercommented, Apr 13, 2020

@rnenjoy This is the setting I have in my .vscode/settings.json

{
  "[vue]": {
    // Vetur uses an old version of prettier
    "editor.defaultFormatter": "esbenp.prettier-vscode"
  }
}

This is specific enough that it doesn’t mess with my other formatting options and fixes the problem with vue files.

1reaction
rnenjoycommented, May 12, 2020

@rnenjoy how do you do that?

Sorry for the delay: Goto %USERPROFILE%.vscode\extensions\octref.vetur-0.24.0\server\dist\modes\script\javascript.js

Change 398 const parser = scriptDoc.languageId === ‘javascript’ ? ‘babylon’ : ‘typescript’; to const parser = scriptDoc.languageId === ‘javascript’ ? ‘babel’ : ‘typescript’;

Read more comments on GitHub >

github_iconTop Results From Across the Web

babel/parser
The Babel parser (previously Babylon) is a JavaScript parser used in Babel. The latest ECMAScript version enabled by default (ES2020). Comment attachment.
Read more >
Prettier 2.0 “2020”
useFlowParser ( --flow-parser in CLI) has been deprecated since v0.0.10 . Option values: parser : babylon (renamed to babel in v1.16.0), ...
Read more >
Why does running prettier check return error "Couldn't resolve ...
ts' with a prettier config shown below, I receive the error stating that the babel-ts parser is not resolved. I'm currently using prettier...
Read more >
@babel/eslint-parser | Yarn - Package Manager
ESLint parser that allows for linting of experimental syntax transformed by Babel. readme. babel. The compiler for writing next generation JavaScript.
Read more >
Open Source Used In Socio 1.0 - Cisco
This document contains licenses and notices for open source software used in ... 1.145 formatjs/icu-messageformat-parser 2.0.14 ... 1.1526 babylon 6.18.0.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found