AstonJ

AstonJ

EG:

  defp deps do
    [
      {:phoenix, "~> 1.4.1"},
      {:phoenix_pubsub, "~> 1.1"},
      {:phoenix_ecto, "~> 4.0"},
    ]
  end

Or do you prefer not to?

  defp deps do
    [
      {:phoenix, "~> 1.4.1"},
      {:phoenix_pubsub, "~> 1.1"},
      {:phoenix_ecto, "~> 4.0"}
    ]
  end

Showing Posts 1 to 10

sribe

sribe

Looks ugly, but I do it so that code diffs better reflect the actual change after an addition…

hauleth

hauleth

I would add them, but formatter removes them after that. So while I would prefer to have trailing commas (but only in multiline expressions) I stopped using them as that is what code formatter expects.

So there unfortunately is no option for me in this survey :frowning:

16
Post #2
AstonJ

AstonJ OP

Oh I didn’t know that :lol:

I actually prefer them without (think I might have slight OCD, lol) but I’m sure I read in one of my Ruby books once that it was best to add them.

hauleth

hauleth

The main problem in Elixir is that trailing comma isn’t always possible, ex.:

def foo(a, b), do: {a, b}

# Legal
foo(10,
    20
)

# Legal
foo(10,
    a: 20
)

# Legal
foo(10
    a: 20,
)

# Illegal
# foo(10,
#     20,
# )
dimitarvp

dimitarvp

Exactly in the camp where @hauleth is: I always add them for consistency and smaller diffs but the formatter always removes them.

blatyo

blatyo

Conduit Core Team

I don’t add them unless the formatter adds them for me. That’s the case for the Javascript stuff I work on and not for the Elixir stuff. When I had to manually added them, I actually felt like I ended up doing more work. Now that formatters add/remove them for me, I don’t care that much. The smaller diff is only slightly compelling to me.

OvermindDL1

OvermindDL1

Another +1 to adding trailing commas on multi-line lists/maps/etc… I always prefer them, diff’s, moving, etc… are always cleaner, but the formatter for some reason thinks more noisy diffs are more useful for reasons that I don’t understand… ^.^;

14
Post #7
jeremyjh

jeremyjh

I much prefer them but yeah, formatter. Our eslint config requires them for javascript.

paulsullivanjr

paulsullivanjr

I can’t do trailing commas. I think it’s an OCD thing for me or something.

peerreynders

peerreynders

I imagine Elm’s leading commas would drive you to distraction …

Where Next? Top

Trending in Discussions Top

AstonJ
As the title says, please share what you’ve been up to with Elixir. Whether that’s been learning it, looking into it, making stuff with i...
2977 92995 915
New
caslu
I want to open this thread for you all to discuss and help those who really like Ash but are still hesitant to use it in a real project. ...
New
mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
Herve37
We’re evaluating API mocking tools for OpenAPI-based projects and would love to hear what other teams are using. We’re particularly inte...
New
GES233
I’m posting this in response to Jose’s recent tweet (Cr. link) : People are sleeping on Elixir for a coding harness: Hot-code swappi...
New
_mfierro
Hello, I wrote Stop My Hand, a Scattergories-like web application using Phoenix/LiveView as my learning project for Elixir (after readin...
New
nseaSeb
AcmeScript — Writing JS hooks as if I were still using Elixir I’ve been having fun building a little something over the last few days: Ac...
New

Other Trending Topics Top

garrison
Hobbes is a low-level distributed database for the Elixir programming language. Hobbes provides a simple, safe, and scalable storage lay...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
mcass19
ExRatatui lets you cook up rich terminal UIs in Elixir, powered by Rust’s ratatui via Rustler NIFs. Build interactive terminal applicatio...
New
Damirados
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve. They are GUI (Emerge) and State management (S...
New
netoum
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
wintermeyer
There are three potential reasons for members of this forum to have a look at https://vutuv.de You are tired or annoyed of LinkedIn. Yo...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews