{"action":"created","issue":{"url":"https://api.github.com/repos/buzinas/tslint-eslint-rules/issues/98","repository_url":"https://api.github.com/repos/buzinas/tslint-eslint-rules","labels_url":"https://api.github.com/repos/buzinas/tslint-eslint-rules/issues/98/labels{/name}","comments_url":"https://api.github.com/repos/buzinas/tslint-eslint-rules/issues/98/comments","events_url":"https://api.github.com/repos/buzinas/tslint-eslint-rules/issues/98/events","html_url":"https://github.com/buzinas/tslint-eslint-rules/pull/98","id":173283770,"number":98,"title":"[fix] add namespaces as valid location for function declaration","user":{"login":"jigawot","id":9836477,"avatar_url":"https://avatars.githubusercontent.com/u/9836477?v=3","gravatar_id":"","url":"https://api.github.com/users/jigawot","html_url":"https://github.com/jigawot","followers_url":"https://api.github.com/users/jigawot/followers","following_url":"https://api.github.com/users/jigawot/following{/other_user}","gists_url":"https://api.github.com/users/jigawot/gists{/gist_id}","starred_url":"https://api.github.com/users/jigawot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jigawot/subscriptions","organizations_url":"https://api.github.com/users/jigawot/orgs","repos_url":"https://api.github.com/users/jigawot/repos","events_url":"https://api.github.com/users/jigawot/events{/privacy}","received_events_url":"https://api.github.com/users/jigawot/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-08-25T19:03:23Z","updated_at":"2016-08-25T19:10:14Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/buzinas/tslint-eslint-rules/pulls/98","html_url":"https://github.com/buzinas/tslint-eslint-rules/pull/98","diff_url":"https://github.com/buzinas/tslint-eslint-rules/pull/98.diff","patch_url":"https://github.com/buzinas/tslint-eslint-rules/pull/98.patch"},"body":"As far as I can tell, the rule about declaring nested functions is as follows:\r\n\r\nIn strict mode, function declarations cannot be nested inside a statement or block. They may only appear at the top level or directly inside a function body.\r\n\r\nThus, if you declare\r\n\r\n```TypeScript\r\nnamespace MyNamespace {\r\n  function MyHelperFunction() {\r\n    console.log(\"This _should_ be allowed.\");\r\n  }\r\n}\r\n```\r\n\r\nit will be compiled into something that looks vaguely like this (depending on your module output setting)\r\n\r\n```JavaScript\r\nvar MyNamespace;\r\n(function (MyNamespace) {\r\n  function MyHelperFunction() {\r\n    console.log(\"This _should_ be allowed.\");\r\n  }\r\n})(MyNamespace || (MyNamespace = {}));\r\n```\r\n\r\nThis, therefore, does not violate the rule about nested functions, but the linter still marks it as invalid.  I propose we add `ts.SyntaxKind.ModuleDeclaration` to the list of valid parent types in noInnerDeclarationsRule.ts and the appropriate associated test case."},"comment":{"url":"https://api.github.com/repos/buzinas/tslint-eslint-rules/issues/comments/242503999","html_url":"https://github.com/buzinas/tslint-eslint-rules/pull/98#issuecomment-242503999","issue_url":"https://api.github.com/repos/buzinas/tslint-eslint-rules/issues/98","id":242503999,"user":{"login":"jigawot","id":9836477,"avatar_url":"https://avatars.githubusercontent.com/u/9836477?v=3","gravatar_id":"","url":"https://api.github.com/users/jigawot","html_url":"https://github.com/jigawot","followers_url":"https://api.github.com/users/jigawot/followers","following_url":"https://api.github.com/users/jigawot/following{/other_user}","gists_url":"https://api.github.com/users/jigawot/gists{/gist_id}","starred_url":"https://api.github.com/users/jigawot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jigawot/subscriptions","organizations_url":"https://api.github.com/users/jigawot/orgs","repos_url":"https://api.github.com/users/jigawot/repos","events_url":"https://api.github.com/users/jigawot/events{/privacy}","received_events_url":"https://api.github.com/users/jigawot/received_events","type":"User","site_admin":false},"created_at":"2016-08-25T19:10:14Z","updated_at":"2016-08-25T19:10:14Z","body":"That test failure seems unrelated to the modification I made.  Is there an outstanding problem I'm unaware of?"}}
{"actor":{"display_login":"jigawot"}}