Comment

Comment by ninjakeyboard

Some extra stuff I've been working on to supplement the the formatter in your workflow a bit:

Pre commit hook: https://github.com/jasongoodwin/elixir-mix-format-pre-commit...

Emacs format current file: https://github.com/jasongoodwin/emacs-elixir-formatter

Generally the formatter is good, but we've noticed a couple cases where it would be nice to override

EG:

it would be nice to have the join and on statements on the same line so you can see as the reader what relates to what

  u in Db.User,
  distinct: u.id,
  join: c in Db.Comment,
  on: u.id == c.user_id,
  join: p in Db.Profile,
  on: u.profile_id == u.id,
  join: x in Db.SomethingElse,
  on: x.profile_id == u.id,
  join: y in Db.AnotherThing,
  on: y.profile_id == u.id,
...

I can see why it's like that, but it would be nice to be able to override it.

Also the formatter requires () so you end up with ecto code differing from the styles recommend in the docs

  schema "thingy" do
    field(:name, :string)
    field(:abbreviation, :string)
  end
instead of

  schema "thingy" do
    field    :name,         :string
    field    :abbreviation, :string
  end
Anyway, still useful and good for the team.

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton