filter_formatter | Hex is a plugin for ‘mix format’ which makes it possible to hook arbitrary command-line filters (i.e. UNIX-style commands consuming input on stdin and producing output on stdout) into your ‘mix format’ runs.
For example, here’s how to configure .formatter.exs
such that mix format
invokes the popular SQLFluff tool to format any SQL statements in SQL
sigils as well as .sql
files.
[
plugins: [FilterFormatter],
filter_formatter: [
[
extensions: ["*.sql"],
sigils: [:SQL],
executable: "sqlformat",
args: ["format", "-", "--dialect", "postgres", "--nocolor", "--disable-progress-bar"]
]
]
]