{"id":13682353,"url":"https://github.com/natefaubion/purescript-tidy","last_synced_at":"2025-03-31T04:19:25.187Z","repository":{"id":37950546,"uuid":"349820395","full_name":"natefaubion/purescript-tidy","owner":"natefaubion","description":"A syntax tidy-upper for PureScript.","archived":false,"fork":false,"pushed_at":"2025-02-16T14:14:27.000Z","size":260,"stargazers_count":92,"open_issues_count":4,"forks_count":11,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-03-22T09:39:53.026Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PureScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/natefaubion.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-03-20T19:44:16.000Z","updated_at":"2025-02-16T14:13:55.000Z","dependencies_parsed_at":"2024-01-14T15:26:05.813Z","dependency_job_id":"e1b42518-254e-4b7d-aabb-f94dd17a001e","html_url":"https://github.com/natefaubion/purescript-tidy","commit_stats":{"total_commits":148,"total_committers":14,"mean_commits":"10.571428571428571","dds":0.3783783783783784,"last_synced_commit":"e76de5aece35c2deda2f5728905d9b669b579f29"},"previous_names":[],"tags_count":38,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/natefaubion%2Fpurescript-tidy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/natefaubion%2Fpurescript-tidy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/natefaubion%2Fpurescript-tidy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/natefaubion%2Fpurescript-tidy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/natefaubion","download_url":"https://codeload.github.com/natefaubion/purescript-tidy/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246413241,"owners_count":20773054,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-02T13:01:44.637Z","updated_at":"2025-03-31T04:19:25.167Z","avatar_url":"https://github.com/natefaubion.png","language":"PureScript","funding_links":[],"categories":["PureScript","Essential tools"],"sub_categories":[],"readme":"# purescript-tidy\n\nA syntax tidy-upper (formatter) for PureScript.\n\n## Install\n\n```console\n$ npm install -g purs-tidy\n```\n\nAlso available for [Nix](https://nixos.org/) via [Nixpkgs 22.11+](https://search.nixos.org/packages?channel=unstable\u0026from=0\u0026size=50\u0026sort=relevance\u0026type=packages\u0026query=purs-tidy) and [Easy PureScript Nix](https://github.com/justinwoo/easy-purescript-nix)\n\n## Usage\n\nYou can use `purs-tidy` to format files in place or via STDIN / STDOUT (which is useful for editor integration):\n\n##### Formatting a collection of files in place:\n\n```console\n$ purs-tidy format-in-place \"src/**/*.purs\"\n```\n\n##### Using STDIN to format a file:\n\n```console\n$ purs-tidy format \u003c MyFile.purs\n```\n\nYou can also use `purs-tidy` to verify whether files have already been formatted. This is often useful to verify, in continuous integration, that all project files are formatted according to the configuration. Files that would be changed by running `format-in-place` are listed out.\n\n\n##### Verifying files are formatted\n\n```console\n$ purs-tidy check \"src/**/*.purs\"\nAll files are formatted.\n```\n\n### Configuration\n\nYou can see all configuration that `purs-tidy` accepts using the `--help` flag for the command you are using:\n\n```console\n$ purs-tidy format-in-place --help\n```\n\nSome common options include:\n\n- `--indent` to set the number of spaces used in indentation, which defaults to 2 spaces\n- `--arrow-first` or `--arrow-last` to control whether type signatures put arrows first on the line or last on the line (purty-style), which defaults to arrow-first.\n\nYou can generate a `.tidyrc.json` using the `generate-config` command. If a `.tidyrc.json` file is found, it will be used in lieu of CLI arguments.\n\n### Operator Precedence\n\nTo support correct operator precedence without having to parse your entire\nsource tree (potentially for a single file), `purs-tidy` uses a pre-baked\noperator precedence table. By default, `purs-tidy` ships with a table built\nfrom the core and contrib organizations. If you need support for more\noperators, you can generate your own table using the `generate-operators`\ncommand.\n\n```console\n$ spago sources | xargs purs-tidy generate-operators \u003e .tidyoperators\n$ purs-tidy generate-config --arrow-first --unicode-never --operators .tidyoperators\n```\n\n## Editor Support\n\n* [Spacemacs](#spacemacs)\n* [Vim](#vim)\n* [VS Code](#vs-code)\n\n### Spacemacs\n\n[Spacemacs' Purescript layer](https://github.com/syl20bnr/spacemacs/tree/develop/layers/%2Blang/purescript)\nsupports formatting using purs-tidy out of the box.\n\nYou can run the formatter manually with either `M-x spacemacs/purescript-format` or with the shortcut `SPC m =`.\n\nTo enable automatic formatting of the buffer on save, enable `purescript-fmt-on-save` in your spacemacs config:\n\n```elisp\n  (setq-default dotspacemacs-configuration-layers '(\n    (purescript :variables\n                purescript-fmt-on-save t)))\n```\n\n\n### Vim\n\n#### via [ALE](https://github.com/dense-analysis/ale)\n\nAdd to your other fixers `.vimrc` or `$XDG_CONFIG_HOME/neovim/init.vim`\n\n```viml\nlet b:ale_fixers = { 'purescript': [ 'purstidy' ] }\n\" suggested to fix on save\nlet g:ale_fix_on_save = 1\n```\n\n#### via [Neoformat](https://github.com/sbdchd/neoformat)\n\nAdd to your `.vimrc` or `$XDG_CONFIG_HOME/neovim/init.vim`\n\n```viml\nlet g:neoformat_enabled_purescript = ['purstidy']\n```\n\n### VS Code\n\n#### via [PureScript IDE](https://marketplace.visualstudio.com/items?itemName=nwolverson.ide-purescript)\n\nThe PureScript IDE plugin for VS Code supports `purs-tidy` as a built-in formatter in versions after `0.25.1`. Choose `purs-tidy` from the list of supported formatters in the settings, or add this to your `settings.json`:\n\n```json\n\"purescript.formatter\": \"purs-tidy\"\n```\n\n## Development\n\n### Requirements\n\n* `purs`: 0.15\n* `spago`: 0.20\n* `node`: 14\n* `esbuild`: 0.14\n\n### Running `bin`\n\nFor local development pointing to the `output` directory:\n\n```console\n$ npm run build\n$ ./bin/index.dev.js --help\n```\n\nFor a local production build pointing to the `bundle` directory:\n\n```console\n$ npm run bundle\n$ ./bin/index.js --help\n```\n\nIf you would like to use your local build of `purs-tidy` in your editor, use path to `bin/index.js` instead of the `purs-tidy` binary in your settings. For example, instead of setting the format command to `purs-tidy format`, set it to `$TIDY_DIR/bin/index.js format` where `$TIDY_DIR` is the location of your checkout of this repository.\n\n### Running `test`\n\nTo accept snapshot tests:\n\n```console\n$ npm run test -- -a \"--accept\"\n```\n\n### Generating the built-in operator table\n\n```console\n$ npm run generate-default-operators\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnatefaubion%2Fpurescript-tidy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnatefaubion%2Fpurescript-tidy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnatefaubion%2Fpurescript-tidy/lists"}