{"id":13394117,"url":"https://github.com/avh4/elm-format","last_synced_at":"2025-05-14T03:03:19.005Z","repository":{"id":2209323,"uuid":"42377692","full_name":"avh4/elm-format","owner":"avh4","description":"elm-format formats Elm source code according to a standard set of rules based on the official Elm Style Guide","archived":false,"fork":false,"pushed_at":"2023-04-13T18:43:21.000Z","size":4031,"stargazers_count":1320,"open_issues_count":228,"forks_count":147,"subscribers_count":24,"default_branch":"main","last_synced_at":"2025-05-10T21:45:55.065Z","etag":null,"topics":["code-style","elm","formatter"],"latest_commit_sha":null,"homepage":"","language":"Haskell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/avh4.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2015-09-13T00:09:34.000Z","updated_at":"2025-04-18T23:04:39.000Z","dependencies_parsed_at":"2023-07-06T23:32:28.545Z","dependency_job_id":null,"html_url":"https://github.com/avh4/elm-format","commit_stats":{"total_commits":1868,"total_committers":66,"mean_commits":"28.303030303030305","dds":0.1953961456102784,"last_synced_commit":"c99aa91b1b239653185e55a2085bceebcd1b5c4b"},"previous_names":[],"tags_count":36,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/avh4%2Felm-format","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/avh4%2Felm-format/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/avh4%2Felm-format/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/avh4%2Felm-format/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/avh4","download_url":"https://codeload.github.com/avh4/elm-format/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254059474,"owners_count":22007767,"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":["code-style","elm","formatter"],"created_at":"2024-07-30T17:01:09.488Z","updated_at":"2025-05-14T03:03:18.926Z","avatar_url":"https://github.com/avh4.png","language":"Haskell","funding_links":[],"categories":["Haskell","Tools","Other tools"],"sub_categories":["Unmaintained"],"readme":"[![Build Status](https://travis-ci.org/avh4/elm-format.svg?branch=master)](https://travis-ci.org/avh4/elm-format)\n[![latest version: 0.8.7](https://img.shields.io/badge/version-0.8.7-orange.svg)](https://github.com/avh4/elm-format/releases/tag/0.8.7)\n\n# elm-format\n\n`elm-format` formats [Elm](https://elm-lang.org) source code\naccording to a standard set of rules based on [the official Elm Style Guide](https://elm-lang.org/docs/style-guide).\nIt is inspired by the popular [gofmt](https://blog.golang.org/go-fmt-your-code).\n\nThe benefits of `elm-format`:\n - It makes code **easier to write**, because you never have to worry about minor formatting concerns while powering out new code.\n - It makes code **easier to read**, because there are no longer distracting minor stylistic differences between different code bases. As such, your brain can map more efficiently from source to mental model.\n - It makes code **easier to maintain**, because you can no longer have diffs related only to formatting; every diff necessarily involves a material change.\n - It **saves your team time** debating how to format things, because there is a standard tool that formats everything the same way.\n - It **saves you time** because you don't have to nitpick over formatting details of your code.\n\n\n## Usage\n\n```bash\nelm-format .  # Format all *.elm files in the current directory\nelm-format Main.elm  # Format a single file\nelm-format Main.elm --yes  # Overwrite the file without prompting\nelm-format src/ Main.elm  # Format the listed files and directories\nelm-format --help  # See other command line options\n```\n\n\n## Installation [![(latest version: 0.8.7)](https://img.shields.io/badge/version-0.8.7-orange.svg)](https://github.com/avh4/elm-format/releases/tag/0.8.7)\n\nTo install `elm-format`:\n\n```sh\nnpm install -g elm-format\n```\n\nor download the version appropriate for your OS from the [release page](https://github.com/avh4/elm-format/releases/tag/0.8.7),\nunzip it,\nand place `elm-format` or `elm-format.exe` (windows) on your `PATH`.\n\nYou must run `elm-format` from the directory that contains your `elm.json` (for Elm 0.19) or `elm-package.json` (for Elm 0.18),\nor else you must pass the appropriate `--elm-version=0.19`/`--elm-version=0.18` command line argument.\n\n\n## Editor integration\n\n\u003c!-- Open-source editors will be listed before closed-source editors. --\u003e\n\nFind your editor in the table below.  The recommended plugin for each editor is indicated with :trophy: (trophy emoji).\n\n\u003ctable\u003e\n  \u003ctr\u003e\n    \u003cth\u003eEditor\u003c/th\u003e\n    \u003cth\u003ePlugin\u003c/th\u003e\n    \u003cth\u003eInstallation\u003c/th\u003e\n    \u003cth\u003e\u003ca href=\"https://github.com/avh4/elm-format/issues/104\"\u003eFormatting\u003c/a\u003e\u003c/th\u003e\n    \u003cth\u003e\u003ca href=\"https://github.com/avh4/elm-format/issues/104\"\u003eFormat on save\u003c/a\u003e\u003c/th\u003e\n    \u003cth\u003e\u003ca href=\"https://github.com/avh4/elm-format/issues/104\"\u003eConfiguration\u003c/a\u003e\u003c/th\u003e\n    \u003cth\u003e\u003ca href=\"https://github.com/avh4/elm-format/issues/104\"\u003eError handling\u003c/a\u003e\u003c/th\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd rowspan=2\u003e\u003ca href=\"https://atom.io/\"\u003eAtom\u003c/a\u003e\u003c/td\u003e\n    \u003ctd\u003e:trophy: \u003ca href=\"https://atom.io/packages/elm-format\"\u003eatom-elm-format\u003c/a\u003e\u003c/td\u003e\n    \u003ctd\u003e:white_check_mark: \u003ca href=\"#atom-elm-format-installation\"\u003e2 steps\u003c/a\u003e\u003c/td\u003e\n    \u003ctd\u003e:white_check_mark:\u003c/td\u003e\n    \u003ctd\u003e:white_check_mark:\u003c/td\u003e\n    \u003ctd\u003e:white_check_mark:\u003c/td\u003e\n    \u003ctd\u003e:warning: no installation instructions\u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003c!-- Atom --\u003e\n    \u003ctd\u003e\u003ca href=\"https://atom.io/packages/atom-beautify\"\u003eatom-beautify\u003c/a\u003e\u003c/td\u003e\n    \u003ctd\u003e:warning: \u003ca href=\"#atom-beautify-installation\"\u003e3 steps\u003c/a\u003e\u003c/td\u003e\n    \u003ctd\u003e:white_check_mark:\u003c/td\u003e\n    \u003ctd\u003e:warning: requires configuration\u003c/td\u003e\n    \u003ctd\u003e:white_check_mark:\u003c/td\u003e\n    \u003ctd\u003e:white_check_mark:\u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd rowspan=1\u003e\u003ca href=\"http://lighttable.com/\"\u003eLight Table\u003c/a\u003e\u003c/td\u003e\n    \u003ctd\u003e:trophy: \u003ca href=\"https://github.com/rundis/elm-light\"\u003eelm-light\u003c/a\u003e\u003c/td\u003e\n    \u003ctd\u003e:warning: \u003ca href=\"#elm-light-installation\"\u003e3 steps\u003c/a\u003e\u003c/td\u003e\n    \u003ctd\u003e:white_check_mark:\u003c/td\u003e\n    \u003ctd\u003e:warning: requires configuration\u003c/td\u003e\n    \u003ctd\u003e:white_check_mark:\u003c/td\u003e\n    \u003ctd\u003e:warning: no installation instructions\u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd rowspan=1\u003eVim\u003c/td\u003e\n    \u003ctd\u003e:trophy: \u003ca href=\"https://github.com/ElmCast/elm-vim\"\u003eelm-vim\u003c/a\u003e\u003c/td\u003e\n    \u003ctd\u003e:x: \u003ca href=\"#elm-vim-installation\"\u003e6 steps\u003c/a\u003e\u003c/td\u003e\n    \u003ctd\u003e:white_check_mark:\u003c/td\u003e\n    \u003ctd\u003e⚠️ requires configuration\u003c/td\u003e\n    \u003ctd\u003e:white_check_mark:\u003c/td\u003e\n    \u003ctd\u003e:x: no error message\u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd rowspan=1\u003eEmacs\u003c/td\u003e\n    \u003ctd\u003e:trophy: \u003ca href=\"https://github.com/jcollard/elm-mode\"\u003eelm-mode\u003c/a\u003e\u003c/td\u003e\n    \u003ctd\u003e:x: \u003ca href=\"#elm-mode-installation\"\u003e4 steps\u003c/a\u003e\u003c/td\u003e\n    \u003ctd\u003e:white_check_mark:\u003c/td\u003e\n    \u003ctd\u003e:warning: requires configuration\u003c/td\u003e\n    \u003ctd\u003e:white_check_mark:\u003c/td\u003e\n    \u003ctd\u003e:warning: no installation instructions\u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd rowspan=1\u003eVisual Studio Code\u003c/td\u003e\n    \u003ctd\u003e:trophy: \u003ca href=\"https://marketplace.visualstudio.com/items?itemName=Elmtooling.elm-ls-vscode\"\u003eElm Tooling\u003c/a\u003e\u003c/td\u003e\n    \u003ctd\u003e:warning: \u003ca href=\"#visual-studio-code-installation\"\u003e3 steps\u003c/a\u003e\u003c/td\u003e\n    \u003ctd\u003e:white_check_mark:\u003c/td\u003e\n    \u003ctd\u003e:warning: requires configuration\u003c/td\u003e\n    \u003ctd\u003e:white_check_mark:\u003c/td\u003e\n    \u003ctd\u003e:x: uninformative error message\u003c/td\u003e\n  \u003c/tr\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd rowspan=1\u003eSublime Text\u003c/td\u003e\n    \u003ctd\u003e:trophy: \u003ca href=\"https://packagecontrol.io/packages/Elm%20Language%20Support\"\u003eElm Language Support\u003c/a\u003e\u003c/td\u003e\n    \u003ctd\u003e:white_check_mark: \u003ca href=\"#sublime-text-installation\"\u003e2 steps\u003c/a\u003e\u003c/td\u003e\n    \u003ctd\u003e❔ TBD\u003c/td\u003e\n    \u003ctd\u003e:white_check_mark:\u003c/td\u003e\n    \u003ctd\u003e❔ TBD\u003c/td\u003e\n    \u003ctd\u003e❔ TBD\u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd rowspan=1\u003eJetBrains (WebStorm, etc)\u003c/td\u003e\n    \u003ctd\u003e:trophy: \u003ca href=\"https://klazuka.github.io/intellij-elm/\"\u003eintellij-elm\u003c/a\u003e\u003c/td\u003e\n    \u003ctd\u003e:warning: \u003ca href=\"#jetbrains-installation\"\u003e4 steps\u003c/a\u003e\u003c/td\u003e\n    \u003ctd\u003e:white_check_mark:\u003c/td\u003e\n    \u003ctd\u003e:warning: requires configuration\u003c/td\u003e\n    \u003ctd\u003e:warning: requires configuration\u003c/td\u003e\n    \u003ctd\u003e❔ TBD\u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd rowspan=1\u003eTextMate\u003c/td\u003e\n    \u003ctd\u003e:trophy: \u003ca href=\"https://github.com/cmason/Elm.tmBundle\"\u003eElm.tmbundle\u003c/a\u003e\u003c/td\u003e\n    \u003ctd\u003e:white_check_mark: \u003ca href=\"https://github.com/cmason/Elm.tmBundle#installation\"\u003e2 steps\u003c/a\u003e\u003c/td\u003e\n    \u003ctd\u003e❔ TBD\u003c/td\u003e\n    \u003ctd\u003e❔ TBD\u003c/td\u003e\n    \u003ctd\u003e❔ TBD\u003c/td\u003e\n    \u003ctd\u003e❔ TBD\u003c/td\u003e\n  \u003c/tr\u003e\n\u003c/table\u003e\n\n\n## Integration with other tools\n\nThese tools also integrate with elm-format:\n\n- [Prettier](https://prettier.io/) via [gicentre/prettier-plugin-elm](https://github.com/gicentre/prettier-plugin-elm)\n\n\n## Detailed installation instructions\n\nIf you can simplify or improve the installation instructions or add instructions for another editor, please [make a pull request](https://github.com/avh4/elm-format/edit/master/README.md).\nThe default behavior of `elm-format`-approved plugins is to format Elm files on save.\n\n\n### atom-elm-format installation\n\n1. Install elm-format\n1. Install atom-elm-format\n\n    ```\n    apm install elm-format\n    ```\n\n  or use the Atom package manager in Atom's settings\n\n\n### atom-beautify installation\n\n1. Install elm-format\n1. Install atom-beautify\n\n    ```\n    apm install atom-beautify\n    ```\n\n  or use the Atom package manager in Atom's settings\n\n1. Use `^⌥B` (`CTRL-ALT-B`) to format a file\n\n\n### elm-light installation\n\n1. Install elm-format\n1. Install the [elm-light plugin](https://github.com/rundis/elm-light) using the Light Table plugin manager\n1. To format on save, edit your user keymap by performing the following:\n  * Click File -\u003e Settings -\u003e User Keymap to open the user keymap.\n  * Copy the following line and paste it into your keymap. Anywhere is fine as long as it is whithin the outer brackets. Ensure to save the file.\n  ```clojure\n  [:editor.elm \"ctrl-s\" :save :elm-format :elm.lint]\n  ```\n  * Search for \"App: Reload keymaps\" in the Commands Window to apply the changes (or restart LightTable).\n\n\n### elm-mode installation\n\n1. Install elm-format\n1. If your Emacs has `package.el` (which is automatically the case for Emacs \u003e= 24), you can install `elm-mode` from the package in [MELPA](http://melpa.milkbox.net/):\n\n    1. Ensure that you have added the MELPA source in your `~/.emacs.d/init.el`:\n\n        ```lisp\n        (require 'package)\n        (add-to-list 'package-archives '(\"melpa\" . \"http://melpa.org/packages/\"))\n        ```\n\n    1. Install elm-mode ([official instructions](https://github.com/jcollard/elm-mode#installation)): Use `M-x list-packages` and choose `elm-mode`.\n\n1. Add the following to your `~/.emacs.d/init.el`:\n\n    ```lisp\n    (add-hook 'elm-mode-hook 'elm-format-on-save-mode)\n    ```\n\n\n### elm-vim installation\n\n\u003e If you are an advanced vim user and already have a preferred vim plugin installation method,\n\u003e you may prefer to refer to the [official elm-vim installation instructions](https://github.com/ElmCast/elm-vim#install).\n\u003e The instructions below are for those who need a step-by-step walkthrough of how to get the plugin set up.\n\n1. Install elm-format\n1. Install [vim-plug](https://github.com/junegunn/vim-plug) ([official instructions](https://github.com/junegunn/vim-plug#installation))\n   NOTE: if you are using neovim, you will need to refer to the official instructions.\n\n    1. Download vim-plug:\n\n        ```bash\n        curl -fLo ~/.vim/autoload/plug.vim --create-dirs \\\n            https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim\n        ```\n\n   1. Make sure `~/.vimrc` exists and has a section like this:\n\n        ```vim\n        call plug#begin('~/.vim/plugged')\n        \" ... any active plugins\n        call plug#end()\n        ```\n\n1. Install elm-vim ([official instructions](https://github.com/ElmCast/elm-vim#install))\n\n    1. Add `Plug 'elmcast/elm-vim'` to the `plug#begin` plugin section in your `~/.vimrc`\n    1. Start `vim` and run `:PlugInstall`\n\n1. Add the following to your `~/.vimrc`:\n\n  ```\n  let g:elm_format_autosave = 1\n  ```\n\n\n### Visual Studio Code installation\n\n1. Install elm-format\n1. Install the extension [Elm Plugin for Visual Studio Code](https://marketplace.visualstudio.com/items?itemName=Elmtooling.elm-ls-vscode).\n1. Configure the extension to format on save:\n\n    1. Find your `settings.json` file ([instructions](https://code.visualstudio.com/docs/getstarted/settings#_settings-file-locations)).\n    1. Add the following key-value pair to your `settings.json`:\n\n    ```json\n    \"[elm]\": {\n        \"editor.formatOnSave\": true\n    },\n    ```\n\n\n### Sublime Text installation\n\n1. Install elm-format\n1. Install the [Elm Language Support](https://packagecontrol.io/packages/Elm%20Language%20Support) package.\n\n\n### JetBrains installation\n\nThis is for WebStorm and other JetBrains IDEs like IntelliJ and PyCharm.\n\n1. Install elm-format\n1. Install the [intellij-elm plugin](https://klazuka.github.io/intellij-elm/)\n1. In IntelliJ, open Settings -\u003e Languages \u0026 Frameworks -\u003e Elm\n\n    1. Specify the path to elm-format (try the \"Auto Discover\" button first)\n    1. Check the \"Run when file saved?\" checkbox\n\n\n\n## Development info\n\nPlease note that this project is released with a [Contributor Code of Conduct](CODE_OF_CONDUCT.md). By participating in this project you agree to abide by its terms.\n\nUse the instructions below to get started.\nMore detailed information is available in [`./dev/Documentation/`](./dev/Documentation/).\n\n### Building from source\n\n1. Install Haskell ghcup following the instructions for your operating system: https://www.haskell.org/ghcup/\n\n```bash\n# check out the repo\ngit clone https://github.com/avh4/elm-format.git\ncd elm-format\n\n# initial setup\nghcup install ghc 9.4.4\nghcup set ghc 9.4.4\ncabal install hpack\n\n# build\ndev/build.sh -- build\n\n# run the built elm-format\n./_build/bin/elm-format/O0/elm-format\n```\n\nSee [`dev/Documentation`](dev/Documentation/README.md) for more contributor and build command documentation.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Favh4%2Felm-format","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Favh4%2Felm-format","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Favh4%2Felm-format/lists"}