AdRoll / rebar3_format

Erlang Formatter for Rebar3
https://tech.nextroll.com/blog/dev/2020/02/25/erlang-rebar3-format.html
MIT License
109 stars 21 forks source link

Add an option to format export lists alphabetically #324

Closed pablocostass closed 2 years ago

pablocostass commented 2 years ago

Currently, default_formatter formats this code…

-export([second_function/3, abc_first_function/1, second_function/2]).

…like this… (no changes whatsoever related to what I am about to propose)

-export([second_function/3, abc_first_function/1, second_function/2]).

I would like it to be formatted like this, by (optionally) first sorting the export list by some definition. In this case, alphabetically, because I feel like it makes finding functions in the export list easier.

Note that the code example had two functions with the same name but different arity; those, I would expect to be sorted by arity

-export([abc_first_function/1, second_function/2, second_function/3]).