prisma-kysely icon indicating copy to clipboard operation
prisma-kysely copied to clipboard

fix: Prettier v3 and up resolveConfig broken

Open wikes82 opened this issue 10 months ago • 6 comments

Fix for issue #94

wikes82 avatar Apr 10 '24 15:04 wikes82

Hey, sorry for the late reply. Are you sure this doesn't break prettier configs that are specified in package.json files for example?

valtyr avatar May 08 '24 00:05 valtyr

Okay interesting. It seems like the resolveConfig method wants the path to the source file in question. Maybe we can pass in the destination path for the generated file here instead of .prettierrc?

https://github.com/prettier/prettier/blob/main/docs/api.md#prettierresolveconfigfileurlorpath--options

valtyr avatar May 08 '24 00:05 valtyr

Hey, sorry for the late reply. Are you sure this doesn't break prettier configs that are specified in package.json files for example?

how about just calling resolveConfig() without parameter ? I tested on my end and it works.

wikes82 avatar May 08 '24 13:05 wikes82

Okay interesting. It seems like the resolveConfig method wants the path to the source file in question. Maybe we can pass in the destination path for the generated file here instead of .prettierrc?

https://github.com/prettier/prettier/blob/main/docs/api.md#prettierresolveconfigfileurlorpath--options

I don't understand this, don't you want to pass user's project prettier config file into resolveConfig ?

wikes82 avatar May 08 '24 13:05 wikes82

@wikes82 If I understand correctly they want the path to the file that prettier is meant to be run on. That is the path to the .ts source file. If calling resolveConfig without a file works I guess that would be fine. It must search from the current working directory and up, but that might be ambiguous in some cases. What do you think?

valtyr avatar May 21 '24 15:05 valtyr

@wikes82 If I understand correctly they want the path to the file that prettier is meant to be run on. That is the path to the .ts source file. If calling resolveConfig without a file works I guess that would be fine. It must search from the current working directory and up, but that might be ambiguous in some cases. What do you think?

Yes, passing the generated files folder path works too. Should we do a fallback ? call resolveConfig without param first, then if the config still null, we call with generated files folder path? To pass in generated folder path, we will need to change writeFileSafely function to accept GeneratorOptions right? will you be ok with it?

wikes82 avatar May 21 '24 15:05 wikes82

Would be useful if we could skip prettier formatting altogether. This step is taking out 3-4s of our build pipeline.

Wdyt @valtyr?

arthurfiorette avatar Oct 11 '24 19:10 arthurfiorette