JohnSmall
Formatter error in Phoenix migrations, can't find ecto_sql
I’m working my way through the Programming Phoenix > 1.4 book and I’ve got a problem with the formatter.
I’m using Atom with Elixir addons, which calls the formatter and reports errors and autofixes the format. But the formatter doesn’t like the migrations. I get this error
** (Mix) Unknown dependency :ecto_sql given to :import_deps in the formatter configuration. The dependency is not listed in your mix.exs for environment :dev
Which is odd because :ecto_sql is very definitely in the list of dependencies in mix.exs, though there isn’t a specific environment for :dev section.
Since this is a plain installation, and follows the book, I’m assuming that other people have the same problem, but I can’t see any other questions being asked.
Anyone have any idea how I get this fixed?
Marked As Solved
JohnSmall
A quick scan of the code shows that it runs mix format inside the first directory where it find a .formatter.exs file for the file being checked.
If I cd into the migrations directory and run mix format etc then I get the exact same error that the package reports.
The workaround is to delete .formatter.exs from the migrations directory. It’s already checked in the configuration inside .formatter.exs in the root directory. Then it works
So the lesson is atom-elixir-formatter can only be run on sub-directories that don’t have a .formatter.exs
Also Liked
AlfredoRoca
I got the same error in VSCode.
I solved it by adding :ecto_sql in .formatter.exs
rgreenjr
@JohnSmall I just published v2.0.0 of atom-elixir-formatter a few days ago, which I believe will fix this issue. It required significant changes, so please take a look and let me know if it works for you.
Popular in Questions
Other popular topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #advent-of-code
- #elixirconf-us
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #performance








