mix eunomo (eunomo v0.1.3)

Formats the given files/patterns.

The default Elixir formatter has the philosophy of not modifying non metadata parts of the AST. Eunomo does not adhere to this philosophy and is meant to be used as an extension to the default formatter. As of now the use case is to sort import, alias and require definitions alphabetically.

To make usage more seamless it is recommended to define an alias in mix.exs. For example:

def project do
  [
    ...,
    aliases: aliases()
  ]
end

defp aliases do
  [
    format!: ["format", "eunomo"]
  ]
end

Now mix format! will run the standard Elixir formatter as well as Eunomo.

Options

Eunomo will read the .eunomo.exs file in the current directory for formatter configuration.

  • :inputs - List of paths and patterns to be formatted. By default the atom :read_from_dot_formatter is passed which will read all :inputs from .formatter.exs.

  • :formatter - List of modules that implement the Eunomo.Formatter behaviour. They are applied sequentially to all matched files.

Task-specific options

  • --check-formatted - checks that the file is already formatted. This is useful in pre-commit hooks and CI scripts if you want to reject contributions with unformatted code.

  • --dry-run - does not save files after formatting.