Make comma at the end of line optional

Claude Pache claude.pache at
Tue Sep 12 15:53:11 UTC 2017

There are [no LineTerminator here] rules in the ES grammar, in order to prevent the most pernicious trap when using ASI:

return // implicit semicolon here
a = b

Those [no LineTerminator here] rules have not been included in constructs that don’t need them. As a result:

const object = {
    get // no implicit comma here
    y: 2
    z: x // no implicit comma here
    in: "foo"

So, no, it’s not a good idea.


More information about the es-discuss mailing list