Skip to content

Move to prettier v3#2184

Merged
jeremymeng merged 9 commits intoAzure:mainfrom
jeremymeng:devtool-vendeored-prettier
Jan 9, 2024
Merged

Move to prettier v3#2184
jeremymeng merged 9 commits intoAzure:mainfrom
jeremymeng:devtool-vendeored-prettier

Conversation

@jeremymeng
Copy link
Copy Markdown
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
Copy Markdown
Member Author

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

// Format the contents if necessary
if (isJson || isSourceCode) {
fileContents = prettier.format(
fileContents = await prettier.format(
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
@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