{"action":"opened","issue":{"url":"https://api.github.com/repos/Gillespie59/eslint-plugin-angular/issues/49","labels_url":"https://api.github.com/repos/Gillespie59/eslint-plugin-angular/issues/49/labels{/name}","comments_url":"https://api.github.com/repos/Gillespie59/eslint-plugin-angular/issues/49/comments","events_url":"https://api.github.com/repos/Gillespie59/eslint-plugin-angular/issues/49/events","html_url":"https://github.com/Gillespie59/eslint-plugin-angular/issues/49","id":59701275,"number":49,"title":"Directives - Limit 1 Per File (Y070)","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":13,"closed_issues":0,"state":"open","created_at":"2015-02-27T19:19:41Z","updated_at":"2015-03-03T20:34:01Z","due_on":null,"closed_at":null},"comments":0,"created_at":"2015-03-03T20:34:01Z","updated_at":"2015-03-03T20:34:01Z","closed_at":null,"body":"https://github.com/johnpapa/angularjs-styleguide/blob/master/README.md\r\n\r\n- Create one directive per file. Name the file for the directive.\r\n\r\n    *Why?*: It is easy to mash all the directives in one file, but difficult to then break those out so some are shared across apps, some across modules, some just for one module.\r\n\r\n    *Why?*: One directive per file is easy to maintain.\r\n\r\n  ```javascript\r\n  /* avoid */\r\n  /* directives.js */\r\n\r\n  angular\r\n      .module('app.widgets')\r\n\r\n      /* order directive that is specific to the order module */\r\n      .directive('orderCalendarRange', orderCalendarRange)\r\n\r\n      /* sales directive that can be used anywhere across the sales app */\r\n      .directive('salesCustomerInfo', salesCustomerInfo)\r\n\r\n      /* spinner directive that can be used anywhere across apps */\r\n      .directive('sharedSpinner', sharedSpinner);\r\n\r\n  function orderCalendarRange() {\r\n      /* implementation details */\r\n  }\r\n\r\n  function salesCustomerInfo() {\r\n      /* implementation details */\r\n  }\r\n\r\n  function sharedSpinner() {\r\n      /* implementation details */\r\n  }\r\n  ```\r\n\r\n  ```javascript\r\n  /* recommended */\r\n  /* calendarRange.directive.js */\r\n\r\n  /**\r\n   * @desc order directive that is specific to the order module at a company named Acme\r\n   * @example <div acme-order-calendar-range></div>\r\n   */\r\n  angular\r\n      .module('sales.order')\r\n      .directive('acmeOrderCalendarRange', orderCalendarRange);\r\n\r\n  function orderCalendarRange() {\r\n      /* implementation details */\r\n  }\r\n  ```\r\n\r\n  ```javascript\r\n  /* recommended */\r\n  /* customerInfo.directive.js */\r\n\r\n  /**\r\n   * @desc spinner directive that can be used anywhere across the sales app at a company named Acme\r\n   * @example <div acme-sales-customer-info></div>\r\n   */\r\n  angular\r\n      .module('sales.widgets')\r\n      .directive('acmeSalesCustomerInfo', salesCustomerInfo);\r\n\r\n  function salesCustomerInfo() {\r\n      /* implementation details */\r\n  }\r\n  ```\r\n\r\n  ```javascript\r\n  /* recommended */\r\n  /* spinner.directive.js */\r\n\r\n  /**\r\n   * @desc spinner directive that can be used anywhere across apps at a company named Acme\r\n   * @example <div acme-shared-spinner></div>\r\n   */\r\n  angular\r\n      .module('shared.widgets')\r\n      .directive('acmeSharedSpinner', sharedSpinner);\r\n\r\n  function sharedSpinner() {\r\n      /* implementation details */\r\n  }\r\n  ```\r\n\r\n    Note: There are many naming options for directives, especially since they can be used in narrow or wide scopes. Choose one that makes the directive and its file name distinct and clear. Some examples are below, but see the naming section for more recommendations."}}