Repository navigation
feat: use Prettier to write config file, if possible - #356
Conversation
|
@all-contributors Please add @JoshuaKGoldberg for ideas and code |
|
I've put up a pull request to add @JoshuaKGoldberg! 🎉 |
|
🎉 This PR is included in version 6.26.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
|
Not sure it's fully related (I'm still investigating) but when passing from 6.25.0 to 6.26.0 of the project the command UPDATE 1 No issue with version 6.25.1. Issue starts at 6.26.0. |
| ) | ||
| } | ||
| return pify(fs.writeFile)(configPath, `${JSON.stringify(content, null, 2)}\n`) | ||
| return pify(fs.writeFile)(configPath, `${formatConfig(content)}\n`) |
There was a problem hiding this comment.
It seems that we pass the content as config, no?
There was a problem hiding this comment.
Here we are replacing this code by JSON.stringify(undefined, null, 2)
The change all-contributors#356 seem to break the formatting of the file .all-contributorsrc. Instead of formatting the content, it formats "undefined". See: - all-contributors#356 (comment) - all-contributors#356 (comment)
What: If the user has the
prettierpackage available in their project and has a Prettier config file (e.g..prettierrc.json), Prettier will be used to write.allcontributorsrcfiles.Why: See #347.
How: Adds
prettieras an optional dependency. Augments the config writing logic to:require('prettier')prettier.resolveConfigFile.sync...falling back to the traditional
JSON.stringify(content, null, 2)if any of that fails.Checklist:
Are
optionalDependenciesthe way to go? I can never keep track of the latest preferences around optionals/peers/etc.