git.iko.soy/rowtype-yoga/pose
on main help sign in
57 lines 1.7 kB history raw
1# POSE - a formatter for PureScript code
3_Disclaimer_: You might want to use the [tidy](https://github.com/natefaubion/purescript-tidy) formatter instead.
5**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.
7## Try it out
9Try the formatter live and find some instructions [here](https://pose.rowtype.yoga)
11## Installation
13We hook into prettier to take care of a lot of the heavy lifting for us so let's install it and the plugin:
15```
16npm install --save-dev prettier @rowtype-yoga/prettier-plugin-purescript
17```
19We only want to format our own code so we modify .prettierignore:
21```
22echo -e ".spago\noutput/" >> .prettierignore
23```
25## Formatting
27If 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:
29```
30npx prettier --write src
31```
33## Contributing
35The project is split in two subpackages:
371. The core formatter in the `packages/core` folder
382. The prettier plugin in the `packages/prettier-plugin-purescript` folder
40To work on the formatter add a test in `packages/core/testfiles/original/` and run:
42```sh
43spago -x exe.dhall test
44```
46Then 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.
48Run the tests often to get nice diffs:
49![image of a diff](../../blob/main/images/diff.png)
51```
5251 passing
531 failed
551) Golden Tests formats Issue5.purs
56 "The diff is saved here: file:///tmp/testfiles-golden-Issue5.purs-actual.html"
57```