Format YAML without conflict with `prettier`
Hi,
Would it be possible to output YAML in a way that doesn't clash with prettier?
pin-github-actions wants files formatted like this:
- needs: [changed-files]
+ needs: [ changed-files ]
prettier formats them back like this:
- needs: [ changed-files ]
+ needs: [changed-files]
I'm facing a similar issue - more generally I would expect this tool to not change formatting whatsoever. Going for prettier formatting might clash with other formatters (or configurations) used elsewhere.
I'm encountering the following specific unexpected reformatting:
example: >
- sit amet justo donec enim diam vulputate ut pharetra sit amet aliquam id diam
- maecenas ultricies mi eget mauris pharetra et ultrices neque ornare aenean
+ sit amet justo donec enim diam vulputate ut pharetra sit amet aliquam id diam maecenas ultricies mi eget mauris pharetra et ultrices neque ornare aenean
more generally I would expect this tool to not change formatting whatsoever.
I agree. 🙂
Unfortunately this is a side effect of parsing the YAML file, then serializing it again. We could try parsing to get the data, then using search + replace on the source file to maintain formatting but that could be brittle.
If anyone wants to try raising a PR with that approach to preserve formatting, I'd be happy to review