fictivekin / eslint-config-fk

MIT License
0 stars 0 forks source link

quote-props: 'as-needed' #12

Closed desandro closed 1 year ago

desandro commented 2 years ago

Currently we have 'quote-props': ['error', 'consistent']. This sets quote marks around object properties.

"consistent" enforces a consistent quote style; in a given object, either all of the properties should be quoted, or none of the properties should be quoted

// consistent. 'new-jersey' requires quotes, so all properties get quotes
{
  'delaware': 0,
  'new-jersey': 1,
  'maryland': 2,
}

Personally, I recommend 'as-needed'.

"as-needed" disallows quotes around object literal property names that are not strictly required

// as-needed. only 'new-jersey' requires quotes
{
  delaware: 0,
  'new-jersey': 1,
  maryland: 2,
}

This feels easier for me to understand. Also consider this situation

// before, consistent
{
  delaware: 0,
  maryland: 2,
}

// add new-jersey. consistent. all lines changed

{
  'delaware': 0,
  'new-jersey': 1,
  'maryland': 2,
}

Vote 👍 to change to as-needed or 👎 to keep consistent

desandro commented 2 years ago

The 👍 's have it. Adding as-needed.