segmentio / eslint-config

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

Proposal: Requiring Spaces before Paren for Anon Functions #5

Closed dominicbarnes closed 9 years ago

dominicbarnes commented 9 years ago

Currently, we require all functions to have no space before the parens. My proposal is to treat anonymous functions differently and instead require there to be a space before those parens.

This is purely aesthetic, and I've seen both styles used throughout our codebase. I just think this style is a little bit cleaner and the little extra whitespace gives a bit of balance.

Documentation for the ESLint Rule: space-before-function-paren

Current

var hello = function() {};

domready(function() {
  // ...
});

return function() {
  // ...
};

Proposed

var hello = function () {};

domready(function () {
  // ...
});

return function () {
  // ...
};