{"action":"opened","issue":{"url":"https://api.github.com/repos/Gillespie59/eslint-plugin-angular/issues/41","labels_url":"https://api.github.com/repos/Gillespie59/eslint-plugin-angular/issues/41/labels{/name}","comments_url":"https://api.github.com/repos/Gillespie59/eslint-plugin-angular/issues/41/comments","events_url":"https://api.github.com/repos/Gillespie59/eslint-plugin-angular/issues/41/events","html_url":"https://github.com/Gillespie59/eslint-plugin-angular/issues/41","id":59696615,"number":41,"title":"Manually Identify Dependencies (Y091)","user":{"login":"Gillespie59","id":555768,"avatar_url":"https://avatars.githubusercontent.com/u/555768?v=3","gravatar_id":"","url":"https://api.github.com/users/Gillespie59","html_url":"https://github.com/Gillespie59","followers_url":"https://api.github.com/users/Gillespie59/followers","following_url":"https://api.github.com/users/Gillespie59/following{/other_user}","gists_url":"https://api.github.com/users/Gillespie59/gists{/gist_id}","starred_url":"https://api.github.com/users/Gillespie59/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Gillespie59/subscriptions","organizations_url":"https://api.github.com/users/Gillespie59/orgs","repos_url":"https://api.github.com/users/Gillespie59/repos","events_url":"https://api.github.com/users/Gillespie59/events{/privacy}","received_events_url":"https://api.github.com/users/Gillespie59/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/Gillespie59/eslint-plugin-angular/labels/Rule","name":"Rule","color":"fef2c0"}],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/Gillespie59/eslint-plugin-angular/milestones/2","html_url":"https://github.com/Gillespie59/eslint-plugin-angular/milestones/0.0.5","labels_url":"https://api.github.com/repos/Gillespie59/eslint-plugin-angular/milestones/2/labels","id":999259,"number":2,"title":"0.0.5","description":"","creator":{"login":"Gillespie59","id":555768,"avatar_url":"https://avatars.githubusercontent.com/u/555768?v=3","gravatar_id":"","url":"https://api.github.com/users/Gillespie59","html_url":"https://github.com/Gillespie59","followers_url":"https://api.github.com/users/Gillespie59/followers","following_url":"https://api.github.com/users/Gillespie59/following{/other_user}","gists_url":"https://api.github.com/users/Gillespie59/gists{/gist_id}","starred_url":"https://api.github.com/users/Gillespie59/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Gillespie59/subscriptions","organizations_url":"https://api.github.com/users/Gillespie59/orgs","repos_url":"https://api.github.com/users/Gillespie59/repos","events_url":"https://api.github.com/users/Gillespie59/events{/privacy}","received_events_url":"https://api.github.com/users/Gillespie59/received_events","type":"User","site_admin":false},"open_issues":8,"closed_issues":0,"state":"open","created_at":"2015-02-27T19:19:41Z","updated_at":"2015-03-03T19:59:50Z","due_on":null,"closed_at":null},"comments":0,"created_at":"2015-03-03T19:59:50Z","updated_at":"2015-03-03T19:59:50Z","closed_at":null,"body":"https://github.com/johnpapa/angularjs-styleguide/edit/master/README.md\r\n\r\n- Use `$inject` to manually identify your dependencies for AngularJS components.\r\n\r\n    *Why?*: This technique mirrors the technique used by [`ng-annotate`](https://github.com/olov/ng-annotate), which I recommend for automating the creation of minification safe dependencies. If `ng-annotate` detects injection has already been made, it will not duplicate it.\r\n\r\n    *Why?*: This safeguards your dependencies from being vulnerable to minification issues when parameters may be mangled. For example, `common` and `dataservice` may become `a` or `b` and not be found by AngularJS.\r\n\r\n    *Why?*: Avoid creating in-line dependencies as long lists can be difficult to read in the array. Also it can be confusing that the array is a series of strings while the last item is the component's function.\r\n\r\n    ```javascript\r\n    /* avoid */\r\n    angular\r\n        .module('app')\r\n        .controller('Dashboard',\r\n            ['$location', '$routeParams', 'common', 'dataservice',\r\n                function Dashboard($location, $routeParams, common, dataservice) {}\r\n            ]);\r\n    ```\r\n\r\n    ```javascript\r\n    /* avoid */\r\n    angular\r\n      .module('app')\r\n      .controller('Dashboard',\r\n          ['$location', '$routeParams', 'common', 'dataservice', Dashboard]);\r\n\r\n    function Dashboard($location, $routeParams, common, dataservice) {\r\n    }\r\n    ```\r\n\r\n    ```javascript\r\n    /* recommended */\r\n    angular\r\n        .module('app')\r\n        .controller('Dashboard', Dashboard);\r\n\r\n    Dashboard.$inject = ['$location', '$routeParams', 'common', 'dataservice'];\r\n\r\n    function Dashboard($location, $routeParams, common, dataservice) {\r\n    }\r\n    ```\r\n\r\n    Note: When your function is below a return statement the $inject may be unreachable (this may happen in a directive). You can solve this by either moving the $inject above the return statement or by using the alternate array injection syntax.\r\n\r\n    Note: [`ng-annotate 0.10.0`](https://github.com/olov/ng-annotate) introduced a feature where it moves the `$inject` to where it is reachable.\r\n\r\n    ```javascript\r\n    // inside a directive definition\r\n    function outer() {\r\n        return {\r\n            controller: DashboardPanel,\r\n        };\r\n\r\n        DashboardPanel.$inject = ['logger']; // Unreachable\r\n        function DashboardPanel(logger) {\r\n        }\r\n    }\r\n    ```\r\n\r\n    ```javascript\r\n    // inside a directive definition\r\n    function outer() {\r\n        DashboardPanel.$inject = ['logger']; // reachable\r\n        return {\r\n            controller: DashboardPanel,\r\n        };\r\n\r\n        function DashboardPanel(logger) {\r\n        }\r\n    }\r\n    ```"}}