You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For certain special-case files, both .exs files in my case, some syntax is legit that isn't normally considered so.
For example:
In .iex.exs, it's very common to import, alias, or require modules without actually using them. In priv/repo/seeds.exs in a Phoenix project, it's pretty much guaranteed you're going to use your Repo to populate your db. In both cases, Lexical gives warnings. In the former they "unsed import/alias/require" warnings, and in the latter it's "could not look up Ecto repo". An example seeds file would look like:
Of course the warnings in .iex.exs could be silenced by adding warn: false to everything, but that is not ideal (though also not the end of the world). I'm not sure if anything can be done about the repo case. I have noticed wrapping everything in if Mix.env() != :test silences it.
Thanks!
The text was updated successfully, but these errors were encountered:
I've been thinking about this, and this seems like it'd be a project-level configuration option, though I don't quite know how we'd implement it. You'd likely need to figure out which errors you'd like to suppress in which files, maybe using a wildcard pattern, but this strategy seems version-specific, as the error messages change slightly from elixir version to version.
I don't see a path forward with the repo case however.
That makes sense to me. AFAIC this is a nice-to-have so I thought I would report. It's not the end of the world and there are ways around it. Thanks for giving it some thought, though :)
For certain special-case files, both
.exs
files in my case, some syntax is legit that isn't normally considered so.For example:
In
.iex.exs
, it's very common to import, alias, or require modules without actually using them. Inpriv/repo/seeds.exs
in a Phoenix project, it's pretty much guaranteed you're going to use yourRepo
to populate your db. In both cases, Lexical gives warnings. In the former they "unsed import/alias/require" warnings, and in the latter it's "could not look up Ecto repo". An example seeds file would look like:Of course the warnings in
.iex.exs
could be silenced by addingwarn: false
to everything, but that is not ideal (though also not the end of the world). I'm not sure if anything can be done about the repo case. I have noticed wrapping everything inif Mix.env() != :test
silences it.Thanks!
The text was updated successfully, but these errors were encountered: