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: prettier config resolving #1351

Merged

Conversation

TheHolyWaffle
Copy link
Contributor

fixes #1350

Copy link

changeset-bot bot commented May 8, 2024

🦋 Changeset detected

Latest commit: a175a49

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

This PR includes changesets to release 6 packages
Name Type
@changesets/cli Patch
@changesets/apply-release-plan Patch
@changesets/write Patch
@changesets/release-utils Patch
@changesets/read Patch
@changesets/get-release-plan 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

Copy link

codesandbox-ci bot commented May 8, 2024

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

@TheHolyWaffle
Copy link
Contributor Author

cc @Andarist request for review 🙏

@@ -133,7 +133,9 @@ export default async function applyReleasePlan(
});

let prettierInstance = getPrettierInstance(cwd);
let prettierConfig = await prettierInstance.resolveConfig(cwd);
let prettierConfig = await prettierInstance.resolveConfig(
path.join(cwd, "package.json")
Copy link
Member

Choose a reason for hiding this comment

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

I don't think this is completely correct. We are going to use the resolved config to format markdown files here so we should resolve a config for a markdown file.

We probably should resolve the config file separately for each file that we want to update but that's a separate issue.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Aha you're right. Pushed a change!

@@ -31,7 +31,9 @@ async function writeChangeset(
});

const prettierInstance = getPrettierInstance(cwd);
const prettierConfig = await prettierInstance.resolveConfig(cwd);
const prettierConfig = await prettierInstance.resolveConfig(
path.join(cwd, "package.json")
Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Aha you're right. Pushed a change!

@TheHolyWaffle TheHolyWaffle requested a review from Andarist May 14, 2024 10:11
@TheHolyWaffle TheHolyWaffle changed the title Fix prettier config resolving fix: prettier config resolving May 14, 2024
) {
await fs.writeFile(
filePath,
// Prettier v3 returns a promise
await prettierInstance.format(content, {
...prettierConfig,
...(await prettierInstance.resolveConfig(filePath)),
filepath: filePath,
Copy link
Member

Choose a reason for hiding this comment

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

it's interesting that we pass a filepath here but we don't do that in the other place. It's either redundant or we should add it in that other place. I don't know which one is more correct so 🤷‍♂️

@Andarist Andarist merged commit c6da182 into changesets:main May 17, 2024
1 check was pending
@github-actions github-actions bot mentioned this pull request May 17, 2024
@TheHolyWaffle TheHolyWaffle deleted the fix-prettier-config-resolution branch May 17, 2024 14:09
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.

changeset version does not respect prettier config since prettier 3.1.1
2 participants