Thanks to visit codestin.com
Credit goes to github.com

Skip to content

fix: prettier config resolving#1351

Merged
Andarist merged 6 commits intochangesets:mainfrom
TheHolyWaffle:fix-prettier-config-resolution
May 17, 2024
Merged

fix: prettier config resolving#1351
Andarist merged 6 commits intochangesets:mainfrom
TheHolyWaffle:fix-prettier-config-resolution

Conversation

@TheHolyWaffle
Copy link
Contributor

fixes #1350

@changeset-bot
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

@codesandbox-ci
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 🙏

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!

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 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
@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