Disclaimer: You might want to use the tidy formatter instead.
The POSE project is in low maintenance mode. This means that pull requests are very welcome but the original authors don't actively improve the code.
Try the formatter live and find some instructions here
We hook into prettier to take care of a lot of the heavy lifting for us so let's install it and the plugin:
npm install --save-dev prettier @rowtype-yoga/prettier-plugin-purescript
We only want to format our own code so we modify .prettierignore:
echo -e ".spago\noutput/" >> .prettierignore
If you use VSCode then you can simply turn on format on save and you're good to go, if you want to manually format some files here's an example:
npx prettier --write src
The project is split in two subpackages:
packages/core
folderpackages/prettier-plugin-purescript
folderTo work on the formatter add a test in packages/core/testfiles/original/
and run:
spago -x exe.dhall test
Then you should adjust the corresponding file in: packages/core/testfiles/golden/
to what you expect the output to be and start making changes in packages/core/src/Format.purs
until all tests pass.
Run the tests often to get nice diffs:
51 passing
1 failed
1) Golden Tests formats Issue5.purs
"The diff is saved here: file:///tmp/testfiles-golden-Issue5.purs-actual.html"