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

fix: fallback to bundled Prettier when finding Prettier 2 #960

Merged
merged 4 commits into from
Oct 2, 2024

Conversation

Princesseuh
Copy link
Member

@Princesseuh Princesseuh commented Oct 1, 2024

Changes

yaml-language-server uses Prettier 2.x to power its formatting, this confuse our formatting because we expect Prettier 3. Really, they shouldn't be using Prettier in the first place (see redhat-developer/yaml-language-server#933), but alas, they do. We don't use their formatting at all, but still this affects us.

This PR refactor the package loading to not try to load Prettier 2 when it's there, which should fix both this situation and also when people have dependencies using Prettier 2. Installing Prettier in your own repo also still works, as require.resolve will find it first before more nested versions.

Fix #946

Testing

Tests should still pass, and tested locally that it outputs the error message correctly

Docs

N/A

Copy link

changeset-bot bot commented Oct 1, 2024

🦋 Changeset detected

Latest commit: 424f908

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
@astrojs/language-server Patch
@astrojs/check Patch
astro-vscode Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@Princesseuh Princesseuh changed the title fix: override prettier version in yaml–language–server fix: fallback to bundled Prettier when finding Prettier 2 Oct 1, 2024
Copy link
Member

@bluwy bluwy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great!

@Princesseuh Princesseuh merged commit 5a44072 into main Oct 2, 2024
4 checks passed
@Princesseuh Princesseuh deleted the fix/override-prettier branch October 2, 2024 11:06
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.

VSCode formatting doesn't work right after running npm astro-create@latest
2 participants