segmentio / eslint-config

Segment's ESLint configurations.
9 stars 6 forks source link

using consistent style for quote-props #25

Closed dominicbarnes closed 9 years ago

dominicbarnes commented 9 years ago

newer versions of eslint added the "consistent-as-needed" style to quote-props, which basically means we can enforce that an entire object is quoted if any 1 property requires quotes:

// quotes everywhere because of ".NET"
var langs = {
  'Android': 'android',
  'curl': 'curl',
  'Go': 'go',
  'iOS': 'ios',
  'Java': 'java',
  'JavaScript': 'js',
  'Node': 'node',
  'PHP': 'php',
  'Python': 'python',
  'Ruby': 'ruby',
  'Xamarin': 'Xamarin',
  '.NET': 'NET',
};

// current style
var langs = {
  Android: 'android',
  curl: 'curl',
  Go: 'go',
  iOS: 'ios',
  Java: 'java',
  JavaScript: 'js',
  Node: 'node',
  PHP: 'php',
  Python: 'python',
  Ruby: 'ruby',
  Xamarin: 'Xamarin',
  '.NET': 'NET',
};

I think it's easier to just keep the entire object consistent, rather than quoting some but not others. You can read more about this rule here.