Make comma at the end of line optional

Алексей agat00 at gmail.com
Tue Sep 12 14:30:03 UTC 2017


Hi all

Now we have a great syntax improvement that allows us to put comma at the
end of arguments lists, object and array definitions. So in multiline
definition last line could have the same signature as others (not only in
multiline, but multiline definition benefits the most).

I would like to propose syntax that would allow to each line looks like the
last:

const object = {
  x: 1
  y: 2
  z: 3
}

The rule here: for multiline arguments list, object or array declaration if
line is a complete statement and next line is not an operator than consider
it as complete argument (field, element) declaration.

Not an operator so you could use

const condition = true
const objext = {
  x: condition
    ? 0
    : 1
  y: 2
  z: 3
}

It is really like ASI but without bugs with "[", "(" and "/" - they should
be consider as a start of a new declaration
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20170912/967caba5/attachment.html>


More information about the es-discuss mailing list