avh4 / elm-format

elm-format formats Elm source code according to a standard set of rules based on the official Elm Style Guide
BSD 3-Clause "New" or "Revised" License
1.31k stars 148 forks source link

instances where formatting formatted code produced a different result #825

Open lue-bird opened 2 months ago

lue-bird commented 2 months ago

Usually formatting things once should result in the same as formatting things twice in a row. Here's 2 exceptions I've encountered:

One: Parenthesized if-then-else in the else branch. For example:

a =
    if True then
        0

    else
        (if False then
            1

         else
            2
        )

first gets formatted to

a =
    if True then
        0

    else
        if False then
            1

        else
            2

then finally

a =
    if True then
        0

    else if False then
        1

    else
        2

(edit: duplicate of https://github.com/avh4/elm-format/issues/634, sorry!)

Two: Having @docs TypeExposingVariants(..), elm-format correctly removes the (..) but then doesn't reorder the that member in the exposing list according to the docs tags. On another run, these get grouped correctly.