{"action":"created","issue":{"url":"https://api.github.com/repos/feross/standard/issues/309","labels_url":"https://api.github.com/repos/feross/standard/issues/309/labels{/name}","comments_url":"https://api.github.com/repos/feross/standard/issues/309/comments","events_url":"https://api.github.com/repos/feross/standard/issues/309/events","html_url":"https://github.com/feross/standard/issues/309","id":113437157,"number":309,"title":"New rule: Add linter for single arg fat arrow functions","user":{"login":"KevinGrandon","id":122602,"avatar_url":"https://avatars.githubusercontent.com/u/122602?v=3","gravatar_id":"","url":"https://api.github.com/users/KevinGrandon","html_url":"https://github.com/KevinGrandon","followers_url":"https://api.github.com/users/KevinGrandon/followers","following_url":"https://api.github.com/users/KevinGrandon/following{/other_user}","gists_url":"https://api.github.com/users/KevinGrandon/gists{/gist_id}","starred_url":"https://api.github.com/users/KevinGrandon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/KevinGrandon/subscriptions","organizations_url":"https://api.github.com/users/KevinGrandon/orgs","repos_url":"https://api.github.com/users/KevinGrandon/repos","events_url":"https://api.github.com/users/KevinGrandon/events{/privacy}","received_events_url":"https://api.github.com/users/KevinGrandon/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":11,"created_at":"2015-10-26T19:51:26Z","updated_at":"2015-11-02T03:09:59Z","closed_at":null,"body":"I think we should implement this rule in the following manner:\r\n\r\n```js\r\n// Passes lint\r\nvar foo = bar => {\r\n  window.alert(bar)\r\n}\r\nfoo('hello')\r\n\r\n// Fails lint\r\nvar foo = (bar) => {\r\n  window.alert(bar)\r\n}\r\nfoo('hello')\r\n```\r\n\r\nThe 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).\r\n\r\nI 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"},"comment":{"url":"https://api.github.com/repos/feross/standard/issues/comments/152899586","html_url":"https://github.com/feross/standard/issues/309#issuecomment-152899586","issue_url":"https://api.github.com/repos/feross/standard/issues/309","id":152899586,"user":{"login":"jprichardson","id":150063,"avatar_url":"https://avatars.githubusercontent.com/u/150063?v=3","gravatar_id":"","url":"https://api.github.com/users/jprichardson","html_url":"https://github.com/jprichardson","followers_url":"https://api.github.com/users/jprichardson/followers","following_url":"https://api.github.com/users/jprichardson/following{/other_user}","gists_url":"https://api.github.com/users/jprichardson/gists{/gist_id}","starred_url":"https://api.github.com/users/jprichardson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jprichardson/subscriptions","organizations_url":"https://api.github.com/users/jprichardson/orgs","repos_url":"https://api.github.com/users/jprichardson/repos","events_url":"https://api.github.com/users/jprichardson/events{/privacy}","received_events_url":"https://api.github.com/users/jprichardson/received_events","type":"User","site_admin":false},"created_at":"2015-11-02T03:09:59Z","updated_at":"2015-11-02T03:09:59Z","body":"I can say this much, I usually write without the parenthesis in the single parameter case. But scanning over code like this:\r\n\r\n```js\r\nvar foo = bar => {\r\n  window.alert(bar)\r\n}\r\n```\r\n\r\nI have to do a double take. Whereas code like this, feels easier to recognize:\r\n\r\n```js\r\nvar foo = (bar) => {\r\n  window.alert(bar)\r\n}\r\n```\r\n\r\nAll very subjective though. I think @feross will just have to pick something :)"}}