prettier: 1.13 breaks Vue / Default parser removal should be breaking change.

UPDATE: 1.13.1 has been released, which changed the error to a warning. 🎉

OLD UPDATE: Anyone experiencing this from vue-cli, please run:

npm update --depth=9999 @vue/component-compiler-utils

OR vue-loader, it is fixed in vue-loader@13.7.2 and vue-loader@14.2.3.

Also, relevant StackOverflow question: https://stackoverflow.com/q/50555953/2010616

Prettier 1.13.0

The removal of default parser in 1.13 breaks some tools relied on the default behavior. https://github.com/vuejs/component-compiler-utils/blob/8a8a95c84dc2f3f14625e31805f975d11a898990/lib/compileTemplate.ts#L161

Expected behavior: This change should be flagged as obsoleted instead of removal or mark this as breaking change instead.

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 16
  • Comments: 26 (12 by maintainers)

Commits related to this issue

Most upvoted comments

Sorry, we committed the age-old semver sin- we knew this was a breaking change, but because it would only affect a subset of our users, we didn’t bump the major version, because we didn’t want to create friction for our users to upgrade.

To get the old behavior, add parser: "babylon". You may also want to lock prettier to a specific version in your package.json.

UPDATE: 1.13.1 has been released, which changed the error to a warning. 🎉

Try updating/reinstalling!

@counterbeing since vue-cli uses prettier API interface here and hardcoded the options, and prettier dependency was added in project @vue/component-compiler-utils,

you could try npm i prettier@~1.12.0 to force the prettier version here.

a breaking change is a breaking change and should always be handled as such even if it only affects a small portion of the userbase

imo you should revert this release

This has been fixed in 1.13.1+

You need to go to the repositories using the Prettier API and get them to add parser: "babylon" or better: pass the file path. vue-cli and vue-loader have been patched, but there’s probably more in the wild.

Re-opening to make this easier to find for people

Labeling with awaiting response so it will be auto-closed in case we forget.

No worry and thanks for the quick response. We always commit some type of sin especially we don’t know how and when and to whom the karma will result.

This could be a minor change as the API in respect of a CLI tool should be the cli args the document literally described. But the community members will always add exceptions with usage scenario we don’t expect.

I have sent a PR to add this to the tool I mentioned above.

@pwang2 Thank you for understanding and sorry for the trouble ❤️