Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(compiler-sfc): specify prettier version (fix #13052) #13053

Merged
merged 1 commit into from
Dec 6, 2023

Conversation

ShGKme
Copy link
Contributor

@ShGKme ShGKme commented Jul 19, 2023

close: #13052

What kind of change does this PR introduce? (check at least one)

  • Bugfix
  • Feature
  • Code style update
  • Refactor
  • Build-related changes
  • Other, please describe:

Does this PR introduce a breaking change? (check one)

  • Yes
  • No

If yes, please describe the impact and migration path for existing applications:

The PR fulfills these requirements:

If adding a new feature, the PR's description includes:

  • A convincing reason for adding this feature (to avoid wasting your time, it's best to open a suggestion issue first and wait for approval before working on it)

Other information:

@vue/compiler-sfc optionally uses Prettier and it is not compatible with Prettier v3.

But prettier is not listed in the package.json.

It wasn't a problem with Prettier v2 because prettier is optional dependency of component-compiler-utils. So Prettier is installed anyway and everything works.

But if some project has Prettier@3, then @vue/compiler-sfc uses project's prettier and fails.

There was the same issue early in component-compiler-utils. See:

This PR specifies Prettier as an optionalDependency of @vue/compiler-sfc. With specified dependency, it will use prettier@2 even if a project has prettier@3.

P.S. I used the same versions as it was in the component-compiler-utils. It seems it has the same code.

Alternative solution: make @vue/compiler-sfc compatible with both Prettier@"1 || 2" and Prettier@3. The problem is that it will make the compile function async.

@ShGKme ShGKme marked this pull request as draft July 19, 2023 17:06
@ShGKme ShGKme force-pushed the chore/specify-prettier-version branch from a1fc76e to e51b52f Compare July 19, 2023 17:13
@ShGKme ShGKme marked this pull request as ready for review July 19, 2023 17:13
@ShGKme ShGKme changed the title fix #13052: chore(compiler): specify prettier version chore(compiler): specify prettier version (fix #13052) Jul 21, 2023
@ShGKme ShGKme changed the title chore(compiler): specify prettier version (fix #13052) chore(compiler-sfc): specify prettier version (fix #13052) Jul 21, 2023
@ShGKme ShGKme force-pushed the chore/specify-prettier-version branch from e51b52f to ed5010e Compare July 21, 2023 08:57
@ShGKme ShGKme force-pushed the chore/specify-prettier-version branch from ed5010e to 786acf9 Compare October 31, 2023 22:42
@yyx990803 yyx990803 merged commit 45d6ad6 into vuejs:main Dec 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

compiler-sfc not compatible with prettier v3
2 participants