Proposal: Allow multiple formatter configuration blocks in .formatter.exs

118 views
Skip to first unread message

michal....@gmail.com

unread,
Jan 17, 2018, 8:08:10 AM1/17/18
to elixir-lang-core
As discussed in this phoenix issue the current formatter configuration interface for a mix project forces its users to apply the configured style across the whole formatted codebase.
While this behavior should be fine for simple settings like line_length, when we introduced the :import_deps option, this behavior may be getting in our way.

Consider a library module specifying a DSL, like Phoenix.Router. It may export a locals_without_parens configuration with a list of functions like options/3 or get/3. A user of such library may want to apply these settings only for his project's source files that use this DSL in order to keep the usual formatting for other options/3 and get/3 functions which may be present in his project.

An example configuration format is presented in this github comment under the same issue.

Additionally, I would propose to extend the export and import_deps options to allow exporting/importing only a part of library's formatter configuration, like {:phoenix, :router_dsl} etc.

José Valim

unread,
Jan 17, 2018, 10:47:34 AM1/17/18
to elixir-l...@googlegroups.com
While I agree such mechanisms may be necessary, can we postpone this discussion by about 2 months? By then we will have a much better perspective of the actual day to day problems and how to better address them. Otherwise we will be only guessing and we may end-up with suboptimal solutions.




José Valim
Founder and 
Director of R&D

--
You received this message because you are subscribed to the Google Groups "elixir-lang-core" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elixir-lang-core+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-core/04200023-5a21-4748-9843-b683b545349e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages