Skip to content

Fix prettier plugins collision (with the one in prettier config file)#343

Open
moranda wants to merge 1 commit into
astahmer:mainfrom
moranda:patch-1
Open

Fix prettier plugins collision (with the one in prettier config file)#343
moranda wants to merge 1 commit into
astahmer:mainfrom
moranda:patch-1

Conversation

@moranda

@moranda moranda commented Jul 22, 2025

Copy link
Copy Markdown

Hello,

I encountered a problem with prettier not being applied even with the --prettier option. I found out that an error was thrown during parsing. The problem was that the typescript plugin was missing because the "plugins" argument of the Prettier.format() function was overridden by the "plugins" property of the options (coming from my .prettierrc file). It ended up with a weird error since prettiers fell back to the prettier installed in my base project which uses async in the parse process. The small addition I provide here should solve the bug and prevent incompatible plugins to be added through config file.

It would be possible to merge the lists instead, but using plugins not present in the openapi-zod-client node_modules may end up with compatibility problems.

Thank you for your very handy package! Hope this PR will help.

Fix a collision between the prettier plugins provided by openapi-zod-client and the ones listed in the prettier config file.

It would be possible to merge the lists instead, but using plugins not present in the openapi-zod-client node_modules may end up with compatibility problems.

Note: the silent "try/catch" tends to hide bugs in this kind of situations. It just doesn't apply prettier.
@vercel

vercel Bot commented Jul 22, 2025

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
openapi-zod-client-rim4 ❌ Failed (Inspect) Jul 22, 2025 2:07pm

@moranda moranda changed the title Update maybePretty.ts Fix prettier plugins collision (with the one in prettier config file) Jul 22, 2025
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.

1 participant