jscs-dev / node-jscs

:arrow_heading_up: JavaScript Code Style checker (unmaintained)
https://jscs-dev.github.io
MIT License
4.96k stars 513 forks source link

airbnb preset - rule #8.2 - omit the braces #2152

Closed iilei closed 8 years ago

iilei commented 8 years ago

If the function body consists of a single expression, omit the braces and use the implicit return. Otherwise, keep the braces and use a return statement.

See rule #8.2

markelog commented 8 years ago

requireShorthandArrowFunctions is good but disallowParenthesesAroundArrowParam isn't, since that rule is strict, whereas this -

[1, 2, 3].map((number) => {
  const nextNumber = number + 1;
  return `A string containing the ${nextNumber}.`;
});

is allowed. /cc @hzoo

Thank you!