{"action":"opened","issue":{"url":"https://api.github.com/repos/jshint/jshint/issues/2814","labels_url":"https://api.github.com/repos/jshint/jshint/issues/2814/labels{/name}","comments_url":"https://api.github.com/repos/jshint/jshint/issues/2814/comments","events_url":"https://api.github.com/repos/jshint/jshint/issues/2814/events","html_url":"https://github.com/jshint/jshint/issues/2814","id":124136247,"number":2814,"title":"unused variable missed when variable declaration separated from initialization ","user":{"login":"saifelse","id":549473,"avatar_url":"https://avatars.githubusercontent.com/u/549473?v=3","gravatar_id":"","url":"https://api.github.com/users/saifelse","html_url":"https://github.com/saifelse","followers_url":"https://api.github.com/users/saifelse/followers","following_url":"https://api.github.com/users/saifelse/following{/other_user}","gists_url":"https://api.github.com/users/saifelse/gists{/gist_id}","starred_url":"https://api.github.com/users/saifelse/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/saifelse/subscriptions","organizations_url":"https://api.github.com/users/saifelse/orgs","repos_url":"https://api.github.com/users/saifelse/repos","events_url":"https://api.github.com/users/saifelse/events{/privacy}","received_events_url":"https://api.github.com/users/saifelse/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-12-28T22:37:17Z","updated_at":"2015-12-28T22:37:17Z","closed_at":null,"body":"Executing:\r\n\r\n    echo '/* jshint unused: true */ var x; x=1; var y=2; var z;' | jshint -                                                                                                          \r\n\r\nOutputs:\r\n\r\n    stdin: line 1, col 43, 'y' is defined but never used.\r\n    stdin: line 1, col 52, 'z' is defined but never used.\r\n    \r\n    2 errors\r\n\r\n`y` and `z` are found to be unused, even though `x` is unused as well. It seems odd that the assignment of `x` results in a usage of `x`.\r\n\r\nFor comparison, `eslint`, correctly identifies all 3 variables as being unused:\r\n\r\n    echo '/*eslint no-unused-vars: 2*/ var x; x=1; var y=2; var z;' | eslint --stdin                                                                                                                      \r\n\r\nOutputs:\r\n\r\n    <text>\r\n      1:34  error  \"x\" is defined but never used  no-unused-vars\r\n      1:46  error  \"y\" is defined but never used  no-unused-vars\r\n      1:55  error  \"z\" is defined but never used  no-unused-vars\r\n    \r\n    ✖ 3 problems (3 errors, 0 warnings)\r\n\r\nThis is particularly annoying when using https://github.com/Clever/coffee-jshint as it is unable to detect unused variables, since `coffee` compiles a declaration into `var x; x = value` and `jshint` cannot detect this as an unused variable."}}