HeexFormatter
A code formatter for Heex templates.
Installation
add :heex_formatter
as dependency
defp deps do
[
# ...
{:heex_formatter, github: "feliperenan/heex_formatter"}
]
end
Add it as plugin to your project .formatter
file.
[
plugins: [HeexFormatter],
import_deps: [:ecto, :phoenix],
inputs: ["*.{heex,ex,exs}", "priv/*/seeds.exs", "{config,lib,test}/**/*.{heex,ex,exs}"],
subdirectories: ["priv/*/migrations"]
]
Now run
mix compile
options
line_length
The formatter defaults to a maximum line_length of 98 characters, which can be overwritten with the line_length
option in the .formatter
file.
Set heex_line_length
to only set the line:lenght for the heex formatter.
[
# ...omitted
heex_line_length: 300
]
Inspired by Surface Formatter.