elm-format icon indicating copy to clipboard operation
elm-format copied to clipboard

Coding style for elm-format contributors

Open avh4 opened this issue 3 years ago • 0 comments

for coding style, it’s currently a bit of a mess, and is just best judgement based on nearby code.

I try to use these rules myself:

  • for files that were copied from elm-compiler, touch them as little as possible, and try to keep the same formatting style as the originals (so that they’re easier to compare with future updates to elm-compiler)
  • for other files, if I’m changing some code, sometimes I will update the formatting of the code right around it, but I try to avoid reformatting code in a PR that’s unrelated to the code change
  • add type annotations for anything newly hand-written that’s top-level

and I guess the style I’ve been sort of using for new code is: 4-space indents, using LambdaCase when possible, and:

if p
    then x
    else y

let
    f = x
in
body

f x y =
    do
        ...

avh4 avatar May 20 '21 19:05 avh4