繁体   English   中英

用混合格式括起来

[英]Parenthesized by mix format

通过asdf安装的macOS 10.13.6上的Elixir 1.7.3 (compiled with Erlang/OTP 19)

我将mix format lib/hello_web/router.ex到以下代码:

pipeline :browser do
  plug :accepts, ["html"]
  plug :fetch_session
  plug :fetch_flash
  plug :protect_from_forgery
  plug :put_secure_browser_headers
end

结果如下:

pipeline :browser do
  plug(:accepts, ["html"])
  plug(:fetch_session)
  plug(:fetch_flash)
  plug(:protect_from_forgery)
  plug(:put_secure_browser_headers)
end

为什么mix format添加()部分? 我配置错误了吗? 如果是:如何解决?

Phoenix DSL的格式化程序配置已于2018年3月9日添加此后该分支再没有发布Phoenix了。 如果要在当前的Phoenix版本中使用它,则需要将相关规则复制到项目的.formatter.exs 要从对plug/1plug/2的调用中删除括号,只需添加以下内容:

[
  ...
  locals_without_parens: [plug: 1, plug: 2],
  ...
]

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM