Skip to content

0.6.0-alpha

Pre-release
Pre-release
Compare
Choose a tag to compare
@avh4 avh4 released this 26 Mar 20:02
0.6.0-alpha

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:

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