{"action":"opened","number":7741,"pull_request":{"url":"https://api.github.com/repos/eslint/eslint/pulls/7741","id":97475682,"html_url":"https://github.com/eslint/eslint/pull/7741","diff_url":"https://github.com/eslint/eslint/pull/7741.diff","patch_url":"https://github.com/eslint/eslint/pull/7741.patch","issue_url":"https://api.github.com/repos/eslint/eslint/issues/7741","number":7741,"state":"open","locked":false,"title":"New: `prefer-destructuring` rule (fixes #6053)","user":{"login":"alexlafroscia","id":1645881,"avatar_url":"https://avatars.githubusercontent.com/u/1645881?v=3","gravatar_id":"","url":"https://api.github.com/users/alexlafroscia","html_url":"https://github.com/alexlafroscia","followers_url":"https://api.github.com/users/alexlafroscia/followers","following_url":"https://api.github.com/users/alexlafroscia/following{/other_user}","gists_url":"https://api.github.com/users/alexlafroscia/gists{/gist_id}","starred_url":"https://api.github.com/users/alexlafroscia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alexlafroscia/subscriptions","organizations_url":"https://api.github.com/users/alexlafroscia/orgs","repos_url":"https://api.github.com/users/alexlafroscia/repos","events_url":"https://api.github.com/users/alexlafroscia/events{/privacy}","received_events_url":"https://api.github.com/users/alexlafroscia/received_events","type":"User","site_admin":false},"body":"**What is the purpose of this pull request? (put an \"X\" next to item)**\r\n\r\n[ ] Documentation update\r\n[ ] Bug fix ([template](https://raw.githubusercontent.com/eslint/eslint/master/templates/bug-report.md))\r\n[x] New rule ([template](https://raw.githubusercontent.com/eslint/eslint/master/templates/rule-proposal.md))\r\n[ ] Changes an existing rule ([template](https://raw.githubusercontent.com/eslint/eslint/master/templates/rule-change-proposal.md))\r\n[ ] Add autofixing to a rule\r\n[ ] Add a CLI option\r\n[ ] Add something to the core\r\n[ ] Other, please explain:\r\n\r\n**Please describe what the rule should do:**\r\n\r\nThis rule ensures that all object property access and array index accesses are done through [ES6 destructuring](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment).\r\n\r\n**What category of rule is this? (place an \"X\" next to just one item)**\r\n\r\n[ ] Enforces code style\r\n[ ] Warns about a potential error\r\n[x] Suggests an alternate way of doing something\r\n[ ] Other (please specify:)\r\n\r\n**Provide 2-3 code examples that this rule will warn about:**\r\n\r\n```diff\r\n- var foo = array[0];\r\n+ var [ foo ] = array;\r\n\r\n- var foo = object.foo;\r\n+ var { foo } = object;\r\n\r\n- var foo = object['foo'];\r\n+ var { foo } = object;\r\n```\r\n\r\n**Why should this rule be included in ESLint (instead of a plugin)?**\r\n\r\nThis change supports (an encourages) a new JavaScript feature that isn't tied directly to any particular framework or library. Additionally, it _is_ part of an existing plugin, [eslint-plugin-ember-suave](https://github.com/DockYard/eslint-plugin-ember-suave/blob/master/lib/rules/prefer-destructuring.js), where I originally authored the rule.  However, someone requested that the rule be added to core in #6053 and asked if I would submit it to core.\r\n\r\n**What changes did you make? (Give an overview)**\r\n\r\n- Added a new rule, `prefer-destructuring`, as well as the tests and documentation that I originally authored as part of the `eslint-plugin-ember-suave`.\r\n\r\n**Is there anything you'd like reviewers to focus on?**\r\n\r\nPlease make sure the tests and documentation are thorough enough. I just copied the implementation, tests and docs from the existing plugin (linked above), which may not have the same level of standards that the core rules have, although I did my best to follow all the best practices when I originally wrote the rule. ","created_at":"2016-12-11T22:24:17Z","updated_at":"2016-12-11T22:24:18Z","closed_at":null,"merged_at":null,"merge_commit_sha":"be955f22f5aa3a33c2455b45b9a6c0dc9c7efe58","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/eslint/eslint/pulls/7741/commits","review_comments_url":"https://api.github.com/repos/eslint/eslint/pulls/7741/comments","review_comment_url":"https://api.github.com/repos/eslint/eslint/pulls/comments{/number}","comments_url":"https://api.github.com/repos/eslint/eslint/issues/7741/comments","statuses_url":"https://api.github.com/repos/eslint/eslint/statuses/7b0b3db7f07e912dd886f4a37bcecbacb9457a8f","head":{"label":"alexlafroscia:add-rule-prefer-destructuring","ref":"add-rule-prefer-destructuring","sha":"7b0b3db7f07e912dd886f4a37bcecbacb9457a8f","user":{"login":"alexlafroscia","id":1645881,"avatar_url":"https://avatars.githubusercontent.com/u/1645881?v=3","gravatar_id":"","url":"https://api.github.com/users/alexlafroscia","html_url":"https://github.com/alexlafroscia","followers_url":"https://api.github.com/users/alexlafroscia/followers","following_url":"https://api.github.com/users/alexlafroscia/following{/other_user}","gists_url":"https://api.github.com/users/alexlafroscia/gists{/gist_id}","starred_url":"https://api.github.com/users/alexlafroscia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alexlafroscia/subscriptions","organizations_url":"https://api.github.com/users/alexlafroscia/orgs","repos_url":"https://api.github.com/users/alexlafroscia/repos","events_url":"https://api.github.com/users/alexlafroscia/events{/privacy}","received_events_url":"https://api.github.com/users/alexlafroscia/received_events","type":"User","site_admin":false},"repo":{"id":76201890,"name":"eslint","full_name":"alexlafroscia/eslint","owner":{"login":"alexlafroscia","id":1645881,"avatar_url":"https://avatars.githubusercontent.com/u/1645881?v=3","gravatar_id":"","url":"https://api.github.com/users/alexlafroscia","html_url":"https://github.com/alexlafroscia","followers_url":"https://api.github.com/users/alexlafroscia/followers","following_url":"https://api.github.com/users/alexlafroscia/following{/other_user}","gists_url":"https://api.github.com/users/alexlafroscia/gists{/gist_id}","starred_url":"https://api.github.com/users/alexlafroscia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alexlafroscia/subscriptions","organizations_url":"https://api.github.com/users/alexlafroscia/orgs","repos_url":"https://api.github.com/users/alexlafroscia/repos","events_url":"https://api.github.com/users/alexlafroscia/events{/privacy}","received_events_url":"https://api.github.com/users/alexlafroscia/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/alexlafroscia/eslint","description":"A fully pluggable tool for identifying and reporting on patterns in JavaScript.","fork":true,"url":"https://api.github.com/repos/alexlafroscia/eslint","forks_url":"https://api.github.com/repos/alexlafroscia/eslint/forks","keys_url":"https://api.github.com/repos/alexlafroscia/eslint/keys{/key_id}","collaborators_url":"https://api.github.com/repos/alexlafroscia/eslint/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/alexlafroscia/eslint/teams","hooks_url":"https://api.github.com/repos/alexlafroscia/eslint/hooks","issue_events_url":"https://api.github.com/repos/alexlafroscia/eslint/issues/events{/number}","events_url":"https://api.github.com/repos/alexlafroscia/eslint/events","assignees_url":"https://api.github.com/repos/alexlafroscia/eslint/assignees{/user}","branches_url":"https://api.github.com/repos/alexlafroscia/eslint/branches{/branch}","tags_url":"https://api.github.com/repos/alexlafroscia/eslint/tags","blobs_url":"https://api.github.com/repos/alexlafroscia/eslint/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/alexlafroscia/eslint/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/alexlafroscia/eslint/git/refs{/sha}","trees_url":"https://api.github.com/repos/alexlafroscia/eslint/git/trees{/sha}","statuses_url":"https://api.github.com/repos/alexlafroscia/eslint/statuses/{sha}","languages_url":"https://api.github.com/repos/alexlafroscia/eslint/languages","stargazers_url":"https://api.github.com/repos/alexlafroscia/eslint/stargazers","contributors_url":"https://api.github.com/repos/alexlafroscia/eslint/contributors","subscribers_url":"https://api.github.com/repos/alexlafroscia/eslint/subscribers","subscription_url":"https://api.github.com/repos/alexlafroscia/eslint/subscription","commits_url":"https://api.github.com/repos/alexlafroscia/eslint/commits{/sha}","git_commits_url":"https://api.github.com/repos/alexlafroscia/eslint/git/commits{/sha}","comments_url":"https://api.github.com/repos/alexlafroscia/eslint/comments{/number}","issue_comment_url":"https://api.github.com/repos/alexlafroscia/eslint/issues/comments{/number}","contents_url":"https://api.github.com/repos/alexlafroscia/eslint/contents/{+path}","compare_url":"https://api.github.com/repos/alexlafroscia/eslint/compare/{base}...{head}","merges_url":"https://api.github.com/repos/alexlafroscia/eslint/merges","archive_url":"https://api.github.com/repos/alexlafroscia/eslint/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/alexlafroscia/eslint/downloads","issues_url":"https://api.github.com/repos/alexlafroscia/eslint/issues{/number}","pulls_url":"https://api.github.com/repos/alexlafroscia/eslint/pulls{/number}","milestones_url":"https://api.github.com/repos/alexlafroscia/eslint/milestones{/number}","notifications_url":"https://api.github.com/repos/alexlafroscia/eslint/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/alexlafroscia/eslint/labels{/name}","releases_url":"https://api.github.com/repos/alexlafroscia/eslint/releases{/id}","deployments_url":"https://api.github.com/repos/alexlafroscia/eslint/deployments","created_at":"2016-12-11T21:42:55Z","updated_at":"2016-12-11T21:43:04Z","pushed_at":"2016-12-11T22:17:07Z","git_url":"git://github.com/alexlafroscia/eslint.git","ssh_url":"git@github.com:alexlafroscia/eslint.git","clone_url":"https://github.com/alexlafroscia/eslint.git","svn_url":"https://github.com/alexlafroscia/eslint","homepage":"http://eslint.org","size":20758,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"eslint:master","ref":"master","sha":"da79f17bf24de631bb24ef422c8dada7261645c4","user":{"login":"eslint","id":6019716,"avatar_url":"https://avatars.githubusercontent.com/u/6019716?v=3","gravatar_id":"","url":"https://api.github.com/users/eslint","html_url":"https://github.com/eslint","followers_url":"https://api.github.com/users/eslint/followers","following_url":"https://api.github.com/users/eslint/following{/other_user}","gists_url":"https://api.github.com/users/eslint/gists{/gist_id}","starred_url":"https://api.github.com/users/eslint/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eslint/subscriptions","organizations_url":"https://api.github.com/users/eslint/orgs","repos_url":"https://api.github.com/users/eslint/repos","events_url":"https://api.github.com/users/eslint/events{/privacy}","received_events_url":"https://api.github.com/users/eslint/received_events","type":"Organization","site_admin":false},"repo":{"id":11061773,"name":"eslint","full_name":"eslint/eslint","owner":{"login":"eslint","id":6019716,"avatar_url":"https://avatars.githubusercontent.com/u/6019716?v=3","gravatar_id":"","url":"https://api.github.com/users/eslint","html_url":"https://github.com/eslint","followers_url":"https://api.github.com/users/eslint/followers","following_url":"https://api.github.com/users/eslint/following{/other_user}","gists_url":"https://api.github.com/users/eslint/gists{/gist_id}","starred_url":"https://api.github.com/users/eslint/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eslint/subscriptions","organizations_url":"https://api.github.com/users/eslint/orgs","repos_url":"https://api.github.com/users/eslint/repos","events_url":"https://api.github.com/users/eslint/events{/privacy}","received_events_url":"https://api.github.com/users/eslint/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/eslint/eslint","description":"A fully pluggable tool for identifying and reporting on patterns in JavaScript.","fork":false,"url":"https://api.github.com/repos/eslint/eslint","forks_url":"https://api.github.com/repos/eslint/eslint/forks","keys_url":"https://api.github.com/repos/eslint/eslint/keys{/key_id}","collaborators_url":"https://api.github.com/repos/eslint/eslint/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/eslint/eslint/teams","hooks_url":"https://api.github.com/repos/eslint/eslint/hooks","issue_events_url":"https://api.github.com/repos/eslint/eslint/issues/events{/number}","events_url":"https://api.github.com/repos/eslint/eslint/events","assignees_url":"https://api.github.com/repos/eslint/eslint/assignees{/user}","branches_url":"https://api.github.com/repos/eslint/eslint/branches{/branch}","tags_url":"https://api.github.com/repos/eslint/eslint/tags","blobs_url":"https://api.github.com/repos/eslint/eslint/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/eslint/eslint/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/eslint/eslint/git/refs{/sha}","trees_url":"https://api.github.com/repos/eslint/eslint/git/trees{/sha}","statuses_url":"https://api.github.com/repos/eslint/eslint/statuses/{sha}","languages_url":"https://api.github.com/repos/eslint/eslint/languages","stargazers_url":"https://api.github.com/repos/eslint/eslint/stargazers","contributors_url":"https://api.github.com/repos/eslint/eslint/contributors","subscribers_url":"https://api.github.com/repos/eslint/eslint/subscribers","subscription_url":"https://api.github.com/repos/eslint/eslint/subscription","commits_url":"https://api.github.com/repos/eslint/eslint/commits{/sha}","git_commits_url":"https://api.github.com/repos/eslint/eslint/git/commits{/sha}","comments_url":"https://api.github.com/repos/eslint/eslint/comments{/number}","issue_comment_url":"https://api.github.com/repos/eslint/eslint/issues/comments{/number}","contents_url":"https://api.github.com/repos/eslint/eslint/contents/{+path}","compare_url":"https://api.github.com/repos/eslint/eslint/compare/{base}...{head}","merges_url":"https://api.github.com/repos/eslint/eslint/merges","archive_url":"https://api.github.com/repos/eslint/eslint/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/eslint/eslint/downloads","issues_url":"https://api.github.com/repos/eslint/eslint/issues{/number}","pulls_url":"https://api.github.com/repos/eslint/eslint/pulls{/number}","milestones_url":"https://api.github.com/repos/eslint/eslint/milestones{/number}","notifications_url":"https://api.github.com/repos/eslint/eslint/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/eslint/eslint/labels{/name}","releases_url":"https://api.github.com/repos/eslint/eslint/releases{/id}","deployments_url":"https://api.github.com/repos/eslint/eslint/deployments","created_at":"2013-06-29T23:59:48Z","updated_at":"2016-12-11T22:21:47Z","pushed_at":"2016-12-11T22:24:18Z","git_url":"git://github.com/eslint/eslint.git","ssh_url":"git@github.com:eslint/eslint.git","clone_url":"https://github.com/eslint/eslint.git","svn_url":"https://github.com/eslint/eslint","homepage":"http://eslint.org","size":20758,"stargazers_count":6464,"watchers_count":6464,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1242,"mirror_url":null,"open_issues_count":290,"forks":1242,"open_issues":290,"watchers":6464,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/eslint/eslint/pulls/7741"},"html":{"href":"https://github.com/eslint/eslint/pull/7741"},"issue":{"href":"https://api.github.com/repos/eslint/eslint/issues/7741"},"comments":{"href":"https://api.github.com/repos/eslint/eslint/issues/7741/comments"},"review_comments":{"href":"https://api.github.com/repos/eslint/eslint/pulls/7741/comments"},"review_comment":{"href":"https://api.github.com/repos/eslint/eslint/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/eslint/eslint/pulls/7741/commits"},"statuses":{"href":"https://api.github.com/repos/eslint/eslint/statuses/7b0b3db7f07e912dd886f4a37bcecbacb9457a8f"}},"merged":false,"mergeable":true,"mergeable_state":"unstable","merged_by":null,"comments":1,"review_comments":0,"commits":1,"additions":281,"deletions":0,"changed_files":4}}
{"actor":{"display_login":"alexlafroscia"}}