Is there a mix plugin or a vscode extension that can automatically sort my aliases in alphabetic order?

GitHub - rrrene/credo: A static code analysis tool for the Elixir language with a focus on code consistency and teaching. has a check for alias order and if your alises are not alphabetically ordered it will produce an error like this The alias App.XYZ is not alphabetically ordered among its group

Is there a mix plugin or a vscode extension that can automatically sort my alises in the alphabetic order? The last thing that I want to be worrying about when coding is alphabetic order.

And BTW I don’t want to low the priority of that check in credo.exs and I don’t want to remove it.

1 Like

In principle you could write a Mix task that uses sourceror to do this, but I’m not aware of an off-the-shelf solution.

My preferred way to deal with this when Credo complains is to use the editor’s “Sort Lines” feature.

And then:

mix refactor sort_aliases [FILE]

1 Like

Also GitHub - hrzndhrn/recode: A linter with autocorrection and a refactoring tool. based on the aforementioned sourceror

3 Likes