elm-format formats Elm source code according to a standard set of rules based on the official Elm Style Guide
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
:
exposing
clauses in module headers are now sortedlet
expressions are no longer indentedFor a more detailed list, see the CHANGELOG
npm install -g elm-format
or download from the release page.
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.
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.
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.
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.
Experimental changes:
exposing
clauses in module headers are now sortedlet
expressions are no longer indentedYou can give feedback about experimental features at https://goo.gl/forms/kLdTN1yikfOI8ZuA3.
Bug fixes:
@docs
lines in module documentation are now handled correctlyOther changes:
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.
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.
Download or run npm install -g elm-format
.
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
}
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.
npm install -g elm-format
. If you try it, please let me know if you run into any problems.--elm-version=0.16
command line option will go away in the future (though it's still available for now).Download or run npm install -g elm-format
.
Thanks to:
npm install -g elm-format
--validate
commandNotes:
--elm-version=0.16
option).Syntax changes:
--
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 listsBug fixes:
where
clause in effect module
s are now required to have at least one field (and comments are now handled correctly)Other changes:
elm-format --validate
(meant for use in CI scripts) now reports errors as JSONnode_modules
folders are ignoredBug fixes: