JohnSmall

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

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

AlfredoRoca

I got the same error in VSCode.
I solved it by adding :ecto_sql in .formatter.exs

rgreenjr

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.

Where Next?

Popular in Questions Top

vertexbuffer
Hello, can anybody help here..? I have a list of players and I what to delete an element, but every for loop the list is reverting to ori...
New
mcarvalho
What is the difference between System.get_env and Application.get_env? For example, what are best practices to use one versus another.
New
myronmarston
The Elixir Typespec docs show the following syntax for keyword lists in typespecs: # ... | [key: type] # keyword lists...
New
hariharasudhan94
lets say i have a sample like a = 20; b = 10; if (a > b) do {:ok, "a"} end if (a < b) do {:ok, b} end if (a == b) do {:ok, "equa...
New
ycv005
I have followed this StackOverflow post to install the specific version of Erlang. And When I am running mix ecto.setup then getting fol...
New
Emily
I have VueJS GUIs with the project generated using Webpack. I have Elixir modules that will need to be used by the VueJS GUIs. I forese...
New
lucidguppy
I have a super simple question about elixir - how would I take a file like this foo bar baz and output a new file that enumerates th...
New
RisingFromAshes
I’ve read in another post that it may be possible with a router helper - but I couldn’t find an appropriate one, and tbh, I’m still just ...
New
bsollish-terakeet
Credo is smart enough to check for (something like) this: assert length(the_list) == 0 with this response: Checking if an enum is empt...
New
rms.mrcs
Hi, I need to transform a list of numbers into a map where the keys are the indexes and the values are the original values of the list. ...
New

Other popular topics Top

mcarvalho
What is the difference between System.get_env and Application.get_env? For example, what are best practices to use one versus another.
New
Nvim
Anybody knows a comprehensive comparison of Django and Phoenix, thanks for the help. Where are they similar? Where do they differ the m...
New
jononomo
I am trying to figure out how Mix knows whether the environment is test, dev, or prod – where is this set? Thanks.
New
msaraiva
Surface is an experimental library built on top of Phoenix LiveView and its new LiveComponent API that aims to provide a more declarative...
564 43622 214
New
JorisKok
I have a server on AWS, and was running a load test using artillery. When looking at the Phoenix dashboard I see the Ports going to 100% ...
New
AstonJ
Please see the new poll here: Which code editor or IDE do you use? (Poll) (2022 Edition) It’s been a while since we first asked this, I...
208 31142 143
New
nobody
Hi! In PHP: $_SERVER[‘SERVER_ADDR’] - in Elixir? Searched the docs for ip address and the web, no good results. Thanks!
New
hariharasudhan94
Lets say I have map like this fetching from my database %{"_id" => #BSON.ObjectId<58eb1a7a9ad169198c3dXXXX>, "email" => ...
New
jononomo
For some reason my phoenix channels are working for me in my local dev environment, but as soon as I deploy via Docker, I get a 403 error...
New
sergio
Kind of like when jquery came out, it was super necessary. Existing drag and drop libraries have a bunch of baggage to support old browse...
New

We're in Beta

About us Mission Statement