Closed
Description
I think we should implement this rule in the following manner:
// Passes lint
var foo = bar => {
window.alert(bar)
}
foo('hello')
// Fails lint
var foo = (bar) => {
window.alert(bar)
}
foo('hello')
The reason being is that with only a single argument, the function is much easier to read without parens. Some folks who don't like this might argue about expansion and having a bigger diff when adding arguments down the road. Since we currently fail lint on trailing commas I think we should fail here on un-needed parens, it feels like it follows the same ideology as the trailing comma rule. (If we did enforce trailing commas, then I would probably enforce parens here as well).
I have a simple eslint plugin here that I'd be happy to include/relinquish: https://github.com/KevinGrandon/eslint-plugins/blob/master/lib/rules/arrow-function-parens.js
Metadata
Assignees
Type
Projects
Status
Done