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

prettier old version #616

Closed
dhrubabasu opened this issue Jul 16, 2021 · 8 comments · Fixed by #905
Closed

prettier old version #616

dhrubabasu opened this issue Jul 16, 2021 · 8 comments · Fixed by #905

Comments

@dhrubabasu
Copy link

Affected Packages

apply-release-plan

Problem

It's relying on an old version of prettier: https://github.com/atlassian/changesets/blob/main/packages/apply-release-plan/package.json#L20

Proposed solution

Is it necessary to ship prettier as a dependency of this package? Could it be moved to devDependencies? If not, upgrade prettier to v2.

@Andarist
Copy link
Member

@mitchellhamilton we could probably use an optional peer dependency here, wdyt? that way we could use whatever is installed by the user (conditionally) - the Prettier JS API probably didn't change much for what we need so it should be pretty straightforward to support its both major versions

@emmatown
Copy link
Member

Yeah, and maybe until the next major we could try requiring prettier from the project root and use our version if that fails and in a major we'd not use prettier if we can't require it from the project root.

threepointone added a commit to cloudflare/workers-sdk that referenced this issue Mar 22, 2022
changesets currently relies on on older version of prettier when generating changelogs, which then makes our `prettier --check` run fail during releases, which breaks our releases (.20. .21, .22). ref: changesets/changesets#616. The fix for now is to simply ignore the changelog when generating the check.
threepointone added a commit to cloudflare/workers-sdk that referenced this issue Mar 22, 2022
changesets currently relies on on older version of prettier when generating changelogs, which then makes our `prettier --check` run fail during releases, which breaks our releases (.20. .21, .22). ref: changesets/changesets#616. The fix for now is to simply ignore the changelog when generating the check.
@alexamy
Copy link
Contributor

alexamy commented Jun 15, 2022

Hey! Today i'm stuck with these problem too. In yarn workspaces prettier from bin is referencing old version, and its caused by apply-release-plan. Any plans to fix this issue?

Solution: I've added prettier resolution in package.json. Now I have incompatible version warning, but changeset works fine.
package.json:

  "resolutions": {
    "prettier": "2.7.0"
  }

@Andarist
Copy link
Member

Hey! Today i'm stuck with these problem too. In yarn workspaces prettier from bin is referencing old version, and its caused by apply-release-plan. Any plans to fix this issue?

I'm not sure I understand this - a demo repository would be helpful. Are you saying that our prettier dependency (transitive one for you) "overrides" your direct dependency and is put within root's~ .bin?

@alexamy
Copy link
Contributor

alexamy commented Jun 16, 2022

Yes, you are right. I will try to make a clean repository with this issue.

@alexamy
Copy link
Contributor

alexamy commented Jun 16, 2022

In clean repo I can't repeat this. I think it's local error then, so its not changesets related. Thanks!

@Princesseuh
Copy link

We're running into an issue on the Astro repo because of the Prettier version being so old. Prettier is trying to run our plugin (prettier-plugin-astro) on the embedded code blocks that use the astro language and since the plugin doesn't work on that version of Prettier (which admittedly, is 3 years old at this point), it just ends up totally nuking the code blocks, here's a diff from a changesets PR:

image

For now, we'll just disable our plugins inside CHANGELOG.md, but it'd be cool to get this working!

@Andarist
Copy link
Member

I've created a PR that, I hope, should fix most of the problems like this: #905

aomarks added a commit to lit/lit that referenced this issue Aug 30, 2022
Previously, weirdness would occur on release because of differences in the Prettier formatting for our CHANGELOG files between our auto-formatter and the formatting that Changesets itself tries to do. This was because Changesets had an old version of Prettier, but our repo had a newer version.

We had a workaround for this where we deleted Changesets' version of Prettier, so that ours would be prefered.

Now that changesets/changesets#905 has landed (fixing changesets/changesets#616), Changesets will prefer our version of Prettier. Plus the version they depend on is now up to date. So we can remove the workaround.
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 a pull request may close this issue.

5 participants