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

Move to prettier v3 #2184

Merged
merged 9 commits into from
Jan 9, 2024
Merged

Conversation

jeremymeng
Copy link
Member

  • use dev-tool run vendored prefix for prettier when generating for Azure SDK for JS repo. Dependency on prettier is no longer used thus removed. Related PR: [engsys][core] switch to run prettier from dev-tool's dependency  azure-sdk-for-js#28127
  • updated prettier to v3 generated package.json in non-azsdkjs packages.
  • upgrade to prettier v3 in this repo as codegen uses prettier to format generated code and we want generated code to be consistent and morden.

@jeremymeng jeremymeng force-pushed the devtool-vendeored-prettier branch from b19f05c to 1da5730 Compare January 3, 2024 00:43
@jeremymeng
Copy link
Member Author

@qiaozha @MaryGao please have a look. Only the first three commits are most meaningful. The rest are mechanical.

@@ -144,7 +144,7 @@ export async function generateTypeScriptLibrary(

// Format the contents if necessary
if (isJson || isSourceCode) {
fileContents = prettier.format(
fileContents = await prettier.format(
Copy link
Member

@MaryGao MaryGao Jan 9, 2024

Choose a reason for hiding this comment

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

Is this introduced by upgrade?

Copy link
Member Author

Choose a reason for hiding this comment

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

yes, v3 makes the method async.

Copy link
Member

@MaryGao MaryGao left a comment

Choose a reason for hiding this comment

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

Thanks for the fix! I am good with this change, just notice that there are a lot of file format changes and wondering why upgrading would cause that because our prettierTypeScriptOptions didn't change.

@jeremymeng
Copy link
Member Author

just notice that there are a lot of file format changes and wondering why upgrading would cause that because our prettierTypeScriptOptions didn't change.

Prettier v3 has some changes in options' default values, the most impactful one to us is the trailingComma option now defaults to "all". There are formatting changes around tenery operator as well.

@jeremymeng jeremymeng merged commit 13e2c8e into Azure:main Jan 9, 2024
28 checks passed
@jeremymeng jeremymeng deleted the devtool-vendeored-prettier branch January 9, 2024 18: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.

3 participants