digitalbazaar / eslint-config-digitalbazaar

BSD 3-Clause "New" or "Revised" License
2 stars 1 forks source link

no trailing commas #17

Closed aljones15 closed 5 years ago

aljones15 commented 5 years ago

Current lint rules allow trailing commas

[1,2,3,]
// this is ok
// however @gannan08 wants this
[1,2]
// no trailing commas

rule is very simple to set: https://eslint.org/docs/rules/comma-dangle

mattcollier commented 5 years ago

First, comma dangle is not allowed in any case in inline arrays or objects. The use case we are discussing is

const x = {
  a: 'foo',
  b: 'bar',
};
const y = [
  'a',
  'b',
];

Here's what I said earlier about this:

what happens in linting rules is one thing, but I object to changing any rule related to allowing trailing comma in regular js code. The premise of allowing trailing comma is that it can lead to cleaner diffs, not saving someone from having to type a comma. So, with code that already has a trailing comma in place in an array or an object, means that the diff can be for just one line if a single property or array member is added.

aljones15 commented 5 years ago

ahhh ok did not know that.

    'comma-dangle': ['error', 'only-multiline'],

that is the existing rule

gannan08 commented 5 years ago

I just want to remove the comma dangle in the eslint configuration template file. I am not proposing any rule changes that restrict other developers.

mattcollier commented 5 years ago

I have no objection to removing the dangling commas from the templates.

aljones15 commented 5 years ago

removing them.

aljones15 commented 5 years ago

@mattcollier @gannan08 can this be closed?

aljones15 commented 5 years ago

closing this as it has been open for a while.