{"action":"created","issue":{"url":"https://api.github.com/repos/babel/babel/issues/2254","labels_url":"https://api.github.com/repos/babel/babel/issues/2254/labels{/name}","comments_url":"https://api.github.com/repos/babel/babel/issues/2254/comments","events_url":"https://api.github.com/repos/babel/babel/issues/2254/events","html_url":"https://github.com/babel/babel/issues/2254","id":102756511,"number":2254,"title":"Babel should detect and error on use before definition","user":{"login":"olov","id":19247,"avatar_url":"https://avatars.githubusercontent.com/u/19247?v=3","gravatar_id":"","url":"https://api.github.com/users/olov","html_url":"https://github.com/olov","followers_url":"https://api.github.com/users/olov/followers","following_url":"https://api.github.com/users/olov/following{/other_user}","gists_url":"https://api.github.com/users/olov/gists{/gist_id}","starred_url":"https://api.github.com/users/olov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/olov/subscriptions","organizations_url":"https://api.github.com/users/olov/orgs","repos_url":"https://api.github.com/users/olov/repos","events_url":"https://api.github.com/users/olov/events{/privacy}","received_events_url":"https://api.github.com/users/olov/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-08-24T10:06:14Z","updated_at":"2015-08-24T13:29:49Z","closed_at":null,"body":"Another defs.js test:\r\n\r\n```js\r\n\"use strict\";\r\n\r\nx; // error (unless disallowUnknownReferences=false)\r\nif (true) {\r\n    (function () {\r\n        x; // error\r\n        if (true) {\r\n            x; // error\r\n        }\r\n        if (true) {\r\n            var _x = undefined;\r\n            _x; // ok\r\n        }\r\n        var f = function f() {\r\n            return x; // ok\r\n        };\r\n        f(); // ok from a static analysis standpoint but runtime error in ES6\r\n\r\n        var x = 3;\r\n\r\n        f(); // ok\r\n        x; // ok\r\n        if (true) {\r\n            x; // ok\r\n        }\r\n    })();\r\n}\r\n```\r\n\r\nExpected errors similar to\r\n```\r\nline 3: reference to unknown global variable x\r\nline 5: x is referenced before its declaration\r\nline 7: x is referenced before its declaration\r\n```\r\n\r\nBabel currently catches only the error in line 3.\r\n"},"comment":{"url":"https://api.github.com/repos/babel/babel/issues/comments/134200940","html_url":"https://github.com/babel/babel/issues/2254#issuecomment-134200940","issue_url":"https://api.github.com/repos/babel/babel/issues/2254","id":134200940,"user":{"login":"sebmck","id":853712,"avatar_url":"https://avatars.githubusercontent.com/u/853712?v=3","gravatar_id":"","url":"https://api.github.com/users/sebmck","html_url":"https://github.com/sebmck","followers_url":"https://api.github.com/users/sebmck/followers","following_url":"https://api.github.com/users/sebmck/following{/other_user}","gists_url":"https://api.github.com/users/sebmck/gists{/gist_id}","starred_url":"https://api.github.com/users/sebmck/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sebmck/subscriptions","organizations_url":"https://api.github.com/users/sebmck/orgs","repos_url":"https://api.github.com/users/sebmck/repos","events_url":"https://api.github.com/users/sebmck/events{/privacy}","received_events_url":"https://api.github.com/users/sebmck/received_events","type":"User","site_admin":false},"created_at":"2015-08-24T13:29:49Z","updated_at":"2015-08-24T13:29:49Z","body":"What heuristic are you using in defs?"}}