{"action":"created","issue":{"url":"https://api.github.com/repos/jshint/jshint/issues/2109","labels_url":"https://api.github.com/repos/jshint/jshint/issues/2109/labels{/name}","comments_url":"https://api.github.com/repos/jshint/jshint/issues/2109/comments","events_url":"https://api.github.com/repos/jshint/jshint/issues/2109/events","html_url":"https://github.com/jshint/jshint/pull/2109","id":54675721,"number":2109,"title":"[[FIX]] Correct bug in enforcement of `singleGroups`","user":{"login":"jugglinmike","id":677252,"avatar_url":"https://avatars.githubusercontent.com/u/677252?v=3","gravatar_id":"","url":"https://api.github.com/users/jugglinmike","html_url":"https://github.com/jugglinmike","followers_url":"https://api.github.com/users/jugglinmike/followers","following_url":"https://api.github.com/users/jugglinmike/following{/other_user}","gists_url":"https://api.github.com/users/jugglinmike/gists{/gist_id}","starred_url":"https://api.github.com/users/jugglinmike/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jugglinmike/subscriptions","organizations_url":"https://api.github.com/users/jugglinmike/orgs","repos_url":"https://api.github.com/users/jugglinmike/repos","events_url":"https://api.github.com/users/jugglinmike/events{/privacy}","received_events_url":"https://api.github.com/users/jugglinmike/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-01-17T21:20:50Z","updated_at":"2015-01-17T21:22:55Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/jshint/jshint/pulls/2109","html_url":"https://github.com/jshint/jshint/pull/2109","diff_url":"https://github.com/jshint/jshint/pull/2109.diff","patch_url":"https://github.com/jshint/jshint/pull/2109.patch"},"body":"When I first implemented this feature, I had the impression that I could limit\r\nits scope to \"single-expression statements\". This turned out to be a flimsy\r\ndistinction, and [the current behavior in `master` produces both false positives\r\nand false negatives](https://github.com/jshint/jshint/issues/2064).\r\n\r\nIn order to properly address the bugs, I felt it was necessary to expand the\r\nresponsibility of this feature to check for *any* unnecessary use of the\r\ngrouping operator. I've updated the warning message and the in-line description\r\nto match this expanded functionality.\r\n\r\nIn order to implement this, I have modified the annotations for some tokens.\r\nSpecifically:\r\n\r\n- Unary operators are now marked as such *before* their operands are consumed\r\n- Delimiter tokens are now marked with a boolean attribute named `delim`\r\n- *Any* token that begins a statement is now marked with a boolean attribute\r\n  named `beginsStmt`\r\n\r\nAll three of these changes enable the kind of lookbehind inference that this\r\nfeature requires. I don't think such sweeping changes should be made lightly,\r\nthough (especially not that last one). If we're not careful, tokens could\r\nbecome a dumping ground for any lazy one-off implementation of fringe features.\r\n\r\nI don't have a good suggestion for how we can avoid this, but I'm willing to\r\nmake the case for the necessity here.\r\n\r\n1. Statement boundary information is **required** for this feature. Without it,\r\n   it is impossible to distinguish when a paren-wrapped function expression\r\n   would have otherwise been interpreted as a function statement.\r\n2. Currently, there is only one canonical location in JSHint that\r\n   differentiates between statement boundaries--the `expression` function. It\r\n   accepts an optional second argument (`initial`) which signals a bounary.\r\n   This means that the only alternative to marking the token would be to\r\n   implement the check in that function body, but since the `expression`\r\n   function is the hottest code path in JSHint, I think we should keep\r\n   processing there to a minimum.\r\n\r\nCommit message:\r\n\r\n> Honor expression binding power when enforcing the `singleGroups` option.\r\n>\r\n> Resolves gh-2064"},"comment":{"url":"https://api.github.com/repos/jshint/jshint/issues/comments/70384961","html_url":"https://github.com/jshint/jshint/pull/2109#issuecomment-70384961","issue_url":"https://api.github.com/repos/jshint/jshint/issues/2109","id":70384961,"user":{"login":"coveralls","id":2354108,"avatar_url":"https://avatars.githubusercontent.com/u/2354108?v=3","gravatar_id":"","url":"https://api.github.com/users/coveralls","html_url":"https://github.com/coveralls","followers_url":"https://api.github.com/users/coveralls/followers","following_url":"https://api.github.com/users/coveralls/following{/other_user}","gists_url":"https://api.github.com/users/coveralls/gists{/gist_id}","starred_url":"https://api.github.com/users/coveralls/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/coveralls/subscriptions","organizations_url":"https://api.github.com/users/coveralls/orgs","repos_url":"https://api.github.com/users/coveralls/repos","events_url":"https://api.github.com/users/coveralls/events{/privacy}","received_events_url":"https://api.github.com/users/coveralls/received_events","type":"User","site_admin":false},"created_at":"2015-01-17T21:22:55Z","updated_at":"2015-01-17T21:22:55Z","body":"\n[![Coverage Status](https://coveralls.io/builds/1760765/badge)](https://coveralls.io/builds/1760765)\n\nCoverage increased (+0.03%) when pulling **5fedda6a7b97eb0a1a260a6e7453f3f193098560 on jugglinmike:fix-single-groups-5** into **32f02e0d4edbb38e1724770b8ea3cce56b4e0888 on jshint:master**.\n"}}