Make comma at the end of line optional

Алексей agat00 at gmail.com
Tue Sep 12 18:17:37 UTC 2017


You should have a reason to write it like this. And if you have than
```js
var arr = [
  1, 2, 3
  4
];
```
would probably be better than
```js
var arr = [
  1, 2, 3,
  4
];
```
And even if you don't - you always have an option to insert a coma at the
end on the line

But in most cases dropping of a comma at the end would not reduce the
readability but only remove the duplicated (by a line break) punctuation

Would you agree that
```js
var a = {
  x: 1
  y: 2
}
```
is not reading worse than
```js
var a = {
  x: 1,
  y: 2
}
```
?

2017-09-12 20:10 GMT+03:00 Jordan Harband <ljharb at gmail.com>:

> Of course not:
> ```js
> var arr = [
>   1, 2, 3
>   4
> ];
> ```
>
> If JS was the kind of language where a line break definitively ended a
> statement, that'd be a different story - but it's not.
>
> On Tue, Sep 12, 2017 at 9:57 AM, Алексей <agat00 at gmail.com> wrote:
>
>> Don't you think that line break is a strong punctuation by itself?
>>
>> 2017-09-12 19:54 GMT+03:00 Jordan Harband <ljharb at gmail.com>:
>>
>>> Punctuation isn't noise.
>>>
>>> On Tue, Sep 12, 2017 at 9:51 AM, dante federici <
>>> c.dante.federici at gmail.com> wrote:
>>>
>>>> I think the only place I see as a current inconsistency is with class
>>>> definitions vs object definitions. It probably should have been looped into
>>>> the object shorthand definition:
>>>>
>>>> https://github.com/tc39/proposal-class-fields
>>>> ```js
>>>> class MyClass {
>>>>   prop = 123
>>>>   constructor() {}
>>>>   method() {}
>>>> }
>>>> ```
>>>> vs
>>>> ```js
>>>> const myObj = {
>>>>   prop: 123,
>>>>   constructor(){},
>>>>   method(){},
>>>> };
>>>> ```
>>>>
>>>> Also, to wit on the class-fields proposal and this issue:
>>>> https://github.com/tc39/proposal-class-fields/issues/7
>>>>
>>>> _______________________________________________
>>>> es-discuss mailing list
>>>> es-discuss at mozilla.org
>>>> https://mail.mozilla.org/listinfo/es-discuss
>>>>
>>>>
>>>
>>> _______________________________________________
>>> es-discuss mailing list
>>> es-discuss at mozilla.org
>>> https://mail.mozilla.org/listinfo/es-discuss
>>>
>>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20170912/e3003afd/attachment.html>


More information about the es-discuss mailing list