TypeStat icon indicating copy to clipboard operation
TypeStat copied to clipboard

Repo: Use the user's formatter on written config files, not JSON.stringify

Open JoshuaKGoldberg opened this issue 2 years ago • 2 comments

A few places in code use JSON.stringify() to write files on disk. For example:

https://github.com/JoshuaKGoldberg/TypeStat/blob/1031fb8fd01b6d52b3781a77b5155d5c899ef54c/src/initialization/initializeJavaScript/index.ts#L19

https://github.com/JoshuaKGoldberg/TypeStat/blob/1031fb8fd01b6d52b3781a77b5155d5c899ef54c/src/initialization/initializeTypeScript/writeMultiTypeScriptConfig.ts#L22

Instead, we should call to ~~prettier and use whatever Prettier~~ whatever formatter & config the user has defined. I have a project for that: https://github.com/JoshuaKGoldberg/formatly

JoshuaKGoldberg avatar Nov 10 '22 11:11 JoshuaKGoldberg