View Source Recode.FormatterPlugin (Recode v0.7.2)

Defines Recode formatter plugin for mix format.

Since Elixir 1.13, it is possible to define custom formatter plugins. This plugin allows you to run Recode autocorrecting tasks together when executing mix format.

To use this formatter, simply add Recode.FormatterPlugin to your .formatter.exs plugins:

  [
    inputs: ["{mix,.formatter}.exs", "{config,lib,test}/**/*.{ex,exs}"],
    plugins: [Recode.FormatterPlugin]
  ]

By default it uses the .recode.exs configuration file.

If your project does not have a .recode.exs configuration file or if you want to overwrite the configuration, you can pass the configuration using the recode option:

  [
    inputs: ["{mix,.formatter}.exs", "{config,lib,test}/**/*.{ex,exs}"],
    plugins: [Recode.FormatterPlugin],
    recode: [
      tasks: [
        {Recode.Task.AliasExpansion, []},
        {Recode.Task.EnforceLineLength, []},
        {Recode.Task.SinglePipe, []}
      ]
    ]
  ]