Ask HN: Do you prefer tailing or leading comma?

https://news.ycombinator.com/item?id=42416080
by aabbcc1241 • 2 years ago
1 4 2 years ago

In the js space, people often leave a tailing comma at the end of each line, when writing the elements of an array.

I was the practise of using leading comma in Elm, where we put a comma at the beginning of each line, when writing elements of a list.

I'm also using leading comma (and leading and/or) when writing sql query.

For example:

    select
      user.id
    , user.username
    from user
    where user.ban_time is null
      and user.activate_time is not null

Related Stories

Loading related stories...

Source preview

news.ycombinator.com