Open lassik opened 5 years ago
Language version may become a first class feature for Unibeautify. Prettier's Trailing Commas
option has an es5
option: https://prettier.io/docs/en/options.html#trailing-commas
Whereas Unibeautify's End With Comma
option is boolean (only true
or false
): https://unibeautify.com/docs/option-end-with-comma.html?language=javascript
I would like to be able to specify the language version (like es5
versus es6
for JavaScript, Python 2 or 3, Elm version, etc) and without an options changing (such as end-with-comma
) it will adapt appropriately.
cc @stevenzeck thoughts?
A generic language version option would be a great way to solve this Elm issue IMHO 😄
Currently elm-format supports two mutually incompatible versions of Elm and needs to know which version code is written for.
elm-format can do this by:
--elm-version
command line optionelm.json
orelm-package.json
in the current directory (the policy of which directories to look in may change in the next version of elm-format, see https://github.com/avh4/elm-format/issues/561)There is no syntax in the Elm language to declare the Elm version directly within a source file itself.
Notably, Unibeautify needs to support formatting unnamed blobs of code that are not saved into any file. For this, the only option would be
--elm-version
. We need to add an equivalent option to the Unibeautify configuration file. @Glavin001 @stevenzeck Opinions on where and how to do this?(Ping @avh4 in case you are interested. Unibeautify may be the most complex/generic real world use case for elm-format since Unibeautify is very generic itself.)