janwirth / elm-coder-generator

Generate encoders and decoders for elm/json
MIT License
12 stars 1 forks source link

Passing the generated code through elm-format? #9

Open qwfy opened 4 years ago

qwfy commented 4 years ago

Some developers have their IDE/editors setup such that, when file is saved, elm-format is run to format the file. However, if there elm-coder-generator manipulates the file, the manipulated file would no longer be elm-format-valid, depending on whether or not the developer saves the file again or not, the manipulate file would have two possible formats:

consider the following scenario:

if we can pass the generated code through elm-format, the problem would be solved.

janwirth commented 4 years ago

That's great feedback. The elm-coder-generator It was developed without regard to elm-format.

I am planning to port a lot of the code to https://package.elm-lang.org/packages/stil4m/elm-syntax/latest/ and also have a stable output when formatted.

However, as a more efficient solutioin, if you want to plug elm-format into the index.js a PR is very welcome. We don't even need a flag.