Nothing happens when I run mix format - is there something wrong with my .formatter.exs?

I have the following .formatter.exs in a Phoenix project:

# Used by "mix format"

wildcard = fn glob -> Path.wildcard(glob, match_dot: true) end

matches = fn globs -> Enum.flat_map(globs, &wildcard.(&1)) end

# except = ["config/config.exs"]

except = []

inputs = ["*.{ex,exs}", "{config,lib,test}/**/*.{ex,exs}"]


  import_deps: [:phoenix, :phx_formatter],

  inputs: matches.(inputs) -- matches.(except),

  line_length: 80


My versions are:
Erlang/OTP 22 [erts-10.7] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1]
Elixir 1.11.3 (compiled with Erlang/OTP 21)

I use Windows 10.

At times, when I run mix format, nothing happens.
Then I perform a fake update of .formatter.exs (adding a space and saving)
and then the next mix format works.
Is there something wrong with my .formatter.exs?

Why does it have to be “nudged” to “wake up”?


It should work. I would try getting an existing project with the formatter, change a file, and see if it works. If it works, it is an issue with your formatter, otherwise the issue is elsewhere. :slight_smile: