Elixir 1.7.3 (compiled with Erlang/OTP 19)
on macOS 10.13.6 installed via asdf .
I run mix format lib/hello_web/router.ex
to the following code:
pipeline :browser do
plug :accepts, ["html"]
plug :fetch_session
plug :fetch_flash
plug :protect_from_forgery
plug :put_secure_browser_headers
end
Here is the result:
pipeline :browser do
plug(:accepts, ["html"])
plug(:fetch_session)
plug(:fetch_flash)
plug(:protect_from_forgery)
plug(:put_secure_browser_headers)
end
Why is mix format
adding the ()
part? Did I misconfigured something? If yes: How can I fix it?
The formatter config for Phoenix's DSLs was added on March 9, 2018 and there has not been any Phoenix release since then from that branch. If you want to use it with the current Phoenix version, you'll need to copy the relevant rules to your project's .formatter.exs
. To remove parentheses from the call to plug/1
and plug/2
, just add this:
[
...
locals_without_parens: [plug: 1, plug: 2],
...
]
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.