Elm Format Versions Save

elm-format formats Elm source code according to a standard set of rules based on the official Elm Style Guide

0.8.1-rc2

5 years ago

0.8.1-rc1

5 years ago

0.8.0

5 years ago

elm-format 0.8.0 most notably includes support for Elm 0.19 (and drops support for Elm 0.16). This includes the --elm-version=0.19 --upgrade mode used by elm-upgrade to help automatically upgrade your code.

This version also includes the successful features from the previous experimental version of elm-format:

  • Imports are now sorted and duplicate imports are merged
  • exposing clauses in module headers are now sorted
  • The body of let expressions are no longer indented
  • Unnecessary parentheses are now removed (except in binary operator expressions)

For a more detailed list, see the CHANGELOG

Install

npm install -g elm-format

or download from the release page.

Thanks to ...

  • @harrysarson for improving the error messages
  • @robx and @alicebob for cleaning up the haskell integration tests and fixing lots of compilation warnings
  • @ahstro for fixing lots of compilation warnings
  • @tac-tics for fixing a parsing bug regarding obsolete keywords
  • many others for contribuing improvements to the README and installation instructions

0.8.0-alpha-elm019rc1-rc2

6 years ago

You only want this if you are trying out the Elm-Platform-0.19 release candidate. If you are using Elm 0.18, you want elm-format-0.7.0-exp instead.

0.8.0-alpha-elm019rc1-rc1

6 years ago

You only want this if you are trying out the Elm-Platform-0.19 release candidate. If you are using Elm 0.18, you want elm-format-0.7.0-exp instead.

0.7.0-exp

7 years ago

elm-format release plan

It's almost time for a stable release of elm-format, and I've been reflecting on the fact that a lot of elm-format's features have benefitted from feedback from people using it on real projects (some features had to be significantly changed after seeing how they worked on real code). To allow the continued improvement of elm-format while still providing stability for those who need it, I've come up with the following plan:

If an elm-format release contains formatting changes that still need to be tested in the real world, it will be tagged as "experimental". Experimental versions will be installed with npm install -g elm-format@exp rather than the default npm install -g elm-format, and each will have a form where people can leave feedback about the experimental features.

I expect most experimental features will need about two months of feedback before a final decision about the feature can be made.

Once feedback has been collected, any failed experiments can be removed, and the next stable version of elm-format will be released. Addition of new formatting rules will result in a minor version bump, and changes to existing formatting rules will result in a major version bump.

User's guide

I've started working on an elm-format user's guide. The goal of the guide is to document more unusual features of elm-format (most notably, continuous integration support) and to provide rationale for some of the more nuanced formatting choices.

Changes in 0.7.0-exp

Experimental changes:

  • Imports are now sorted and duplicate imports are merged
  • exposing clauses in module headers are now sorted
  • The body of let expressions are no longer indented
  • Unnecessary parentheses are now removed
  • (still experimental from 0.6.1-alpha) elm-format now formats your documentation comments

You can give feedback about experimental features at https://goo.gl/forms/kLdTN1yikfOI8ZuA3.

Bug fixes:

  • Initial @docs lines in module documentation are now handled correctly
  • Formatting for lambdas with multiline patterns is now implemented
  • Code blocks in doc comments that immediately follow lists are now handled correctly

Other changes:

  • elm-format now has a contributor code of conduct

Install

npm install -g elm-format@exp

or download from the release page.

You can provide feedback about the experimental features at https://goo.gl/forms/kLdTN1yikfOI8ZuA3.

Thanks to ...

  • @basile-henry for the initial work on import sorting
  • @mattjbray for maintaining the Arch Linux package
  • @brendanbenson for documentation fixes

0.6.1-alpha

7 years ago

Okay, I lied in the 0.6.0-alpha announcement 😄 I decided to add one more big feature before preparing for the public beta.

So I'm excited to announce elm-format-0.6.1-alpha! The one change is that elm-format now formats your documentation comments, including any Elm code examples in your documentation.

Please try it out and let me know if you run into any problems. I had to make a few choices about what the normalized markdown format should be based on the doc comments of some existing packages, so if you have a lot of familiarity with markdown parsers and have opinions about this, or if you know of other projects that have defined a normalized markdown format, please create a discussion issue on github.

Install

Download or run npm install -g elm-format.

0.6.0-alpha

7 years ago

elm-format 0.6.0-alpha

It's finally time for another elm-format alpha release! There are some significant changes, notably with how comments are formatted. If you run into any misbehaving comments or find places where the new formatting rules do undesirable things, please let me know and/or open a github issue.

If you have already been using elm-format, you probably have some code with poorly-aligned comments like this:

origin =
    { x =
        0.49
        -- this is to adjust for retina displays
    , y = 0.0
    }

elm-format-0.6.0-alpha now allows end-of-line comments, and grouping of record fields and list items with comments. The code above now parses as a grouping comment, which will format as:

origin =
    { x =
        0.49

    -- this is to adjust for retina displays
    , y = 0.0
    }

But in many cases (such as in this example), you will probably want to manually change it to:

origin =
    { x = 0.49 -- this is to adjust for retina displays
    , y = 0.0
    }

What's next

Up to this point, elm-format has been "alpha", meaning I've only announced it on elm-dev. If there are no big concerns with the 0.6.0-alpha release, then I'm planning to release a "public beta" in the next couple weeks, which I'll announce on elm-discuss for the first time. After that, there are just a few formatting questions and small bugs to resolve before a 1.0.0 release, at which point I'll start going through the official Elm documentation and core packages to get them formatted with the standard style.

Other notes about this release

  • Windows binaries are now compiled for 32-bit. These should work on 64-bit environments. If you have any problems with this, please let me know.
  • Linux binaries are now built using docker. If you run into any problems with the linux binaries, please let me know.
  • There is now an npm installer npm install -g elm-format. If you try it, please let me know if you run into any problems.
  • Elm 0.16 support is going away. There is no longer an elm-format binary for Elm 0.16, and the --elm-version=0.16 command line option will go away in the future (though it's still available for now).

Install

Download or run npm install -g elm-format.

Contributors

Thanks to:

  • @bobbypriambodo and @rtfeldman for making npm install -g elm-format
  • @ento for adding machine-readable JSON output to the --validate command
  • @joneshf, @stoeffel and @jwoudenberg for suggesting some internal refactorings
  • @falti for a small bug fix

Changelog

Notes:

  • Support for Elm 0.16 is deprecated (but is still available with the --elm-version=0.16 option).

Syntax changes:

  • Removed a workaround for an Elm 0.16 compiler bug that added extra parenthesis to qualified type tags in pattern matches
  • End-of-line -- comments are now kept on their original line when appropriate
  • -- comments in the middle of binary operator sequences no longer push the following expression to the next line
  • -- comments can be use to create sections in records and lists
  • For Windows, CRLF newlines no longer corrupt literal strings

Bug fixes:

  • Empty records containing multiline comments are now handled correctly
  • Double quotes at the end of multiline strings are now handled correctly
  • The where clause in effect modules are now required to have at least one field (and comments are now handled correctly)
  • Record expressions with a trailing comma are no longer allowed (and comments are now handled correctly)
  • Block comments containing only multiple lines of whitespace no longer crash elm-format

Other changes:

  • elm-format --validate (meant for use in CI scripts) now reports errors as JSON
  • When recursively searching a directory, node_modules folders are ignored

0.5.2-alpha

7 years ago

Bug fixes:

  • When upgrading backticks, parentheses are correctly added if the second argument is a function call
  • Added a workaround for an elm-compiler bug where patterns with literal negative numbers cannot be used without parentheses in case expressions