{"action":"created","comment":{"url":"https://api.github.com/repos/eslint/eslint/pulls/comments/226162911","pull_request_review_id":165918025,"id":226162911,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIyNjE2MjkxMQ==","diff_hunk":"@@ -96,6 +97,50 @@ function getDestructuringHost(reference) {\n     return node;\n }\n \n+/**\n+ * Determines if a destructuring assignment node contains\n+ * any MemberExpression nodes. This is used to determine if a\n+ * variable that is only written once using destructuring can be\n+ * safely converted into a const declaration.\n+ * @param {ASTNode} node The ObjectPattern or ArrayPattern node to check.\n+ * @returns {boolean} True if the destructuring pattern contains\n+ *      a MemberExpression, false if not.\n+ */\n+function hasMemberExpressionAssignment(node) {\n+    switch (node.type) {\n+        case \"ObjectPattern\":\n+            return node.properties.some(prop => {\n+                if (prop) {\n+                    const nodeToCheck = (prop.type === \"RestElement\")","path":"lib/rules/prefer-const.js","position":26,"original_position":26,"commit_id":"23d4197e3d96d3181d5b6b6690276cc13a6afaa9","original_commit_id":"23d4197e3d96d3181d5b6b6690276cc13a6afaa9","user":{"login":"mysticatea","id":1937871,"node_id":"MDQ6VXNlcjE5Mzc4NzE=","avatar_url":"https://avatars2.githubusercontent.com/u/1937871?v=4","gravatar_id":"","url":"https://api.github.com/users/mysticatea","html_url":"https://github.com/mysticatea","followers_url":"https://api.github.com/users/mysticatea/followers","following_url":"https://api.github.com/users/mysticatea/following{/other_user}","gists_url":"https://api.github.com/users/mysticatea/gists{/gist_id}","starred_url":"https://api.github.com/users/mysticatea/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mysticatea/subscriptions","organizations_url":"https://api.github.com/users/mysticatea/orgs","repos_url":"https://api.github.com/users/mysticatea/repos","events_url":"https://api.github.com/users/mysticatea/events{/privacy}","received_events_url":"https://api.github.com/users/mysticatea/received_events","type":"User","site_admin":false},"body":"Probably `babel-eslint` makes the type `ExperimentalRestProeprty` even now. Null-check may be safer than...","created_at":"2018-10-18T04:04:18Z","updated_at":"2018-10-18T04:04:18Z","html_url":"https://github.com/eslint/eslint/pull/10924#discussion_r226162911","pull_request_url":"https://api.github.com/repos/eslint/eslint/pulls/10924","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/eslint/eslint/pulls/comments/226162911"},"html":{"href":"https://github.com/eslint/eslint/pull/10924#discussion_r226162911"},"pull_request":{"href":"https://api.github.com/repos/eslint/eslint/pulls/10924"}}},"pull_request":{"url":"https://api.github.com/repos/eslint/eslint/pulls/10924","id":220777715,"node_id":"MDExOlB1bGxSZXF1ZXN0MjIwNzc3NzE1","html_url":"https://github.com/eslint/eslint/pull/10924","diff_url":"https://github.com/eslint/eslint/pull/10924.diff","patch_url":"https://github.com/eslint/eslint/pull/10924.patch","issue_url":"https://api.github.com/repos/eslint/eslint/issues/10924","number":10924,"state":"open","locked":false,"title":"Fix: prefer-const when using destructuring assign (fixes #8308)","user":{"login":"nzakas","id":38546,"node_id":"MDQ6VXNlcjM4NTQ2","avatar_url":"https://avatars3.githubusercontent.com/u/38546?v=4","gravatar_id":"","url":"https://api.github.com/users/nzakas","html_url":"https://github.com/nzakas","followers_url":"https://api.github.com/users/nzakas/followers","following_url":"https://api.github.com/users/nzakas/following{/other_user}","gists_url":"https://api.github.com/users/nzakas/gists{/gist_id}","starred_url":"https://api.github.com/users/nzakas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nzakas/subscriptions","organizations_url":"https://api.github.com/users/nzakas/orgs","repos_url":"https://api.github.com/users/nzakas/repos","events_url":"https://api.github.com/users/nzakas/events{/privacy}","received_events_url":"https://api.github.com/users/nzakas/received_events","type":"User","site_admin":false},"body":"<!--\r\n    ESLint adheres to the [JS Foundation Code of Conduct](https://js.foundation/community/code-of-conduct).\r\n-->\r\n\r\n**What is the purpose of this pull request? (put an \"X\" next to item)**\r\n\r\n[ ] Documentation update\r\n[x] Bug fix ([template](https://raw.githubusercontent.com/eslint/eslint/master/templates/bug-report.md))\r\n[ ] 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<!--\r\n    If the item you've checked above has a template, please paste the template questions below and answer them. (If this pull request is addressing an issue, you can just paste a link to the issue here instead.)\r\n-->\r\n\r\n<!--\r\n    Please ensure your pull request is ready:\r\n\r\n    - Read the pull request guide (https://eslint.org/docs/developer-guide/contributing/pull-requests)\r\n    - Include tests for this change\r\n    - Update documentation for this change (if appropriate)\r\n-->\r\n\r\n<!--\r\n    The following is required for all pull requests:\r\n-->\r\n\r\n**What changes did you make? (Give an overview)**\r\n\r\nChanged `prefer-const` so that it considers destructuring assignment with an object property to disqualify using `const` for variables used in the same destructuring assignment.\r\n\r\n\r\n**Is there anything you'd like reviewers to focus on?**\r\n\r\nIs this the correct approach? It seems like the key to fixing this bug was to consider object properties in destructuring assignment to be the key factor in determining if a variable should be declared with `const`. I'm not 100% this is the correct assumption, so please double-check that.\r\n","created_at":"2018-10-05T17:52:31Z","updated_at":"2018-10-18T04:04:18Z","closed_at":null,"merged_at":null,"merge_commit_sha":"0de5a32b81adb642fc60ffda1c949c7120a7bfef","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":45711350,"node_id":"MDU6TGFiZWw0NTcxMTM1MA==","url":"https://api.github.com/repos/eslint/eslint/labels/bug","name":"bug","color":"fc2929","default":true},{"id":45798639,"node_id":"MDU6TGFiZWw0NTc5ODYzOQ==","url":"https://api.github.com/repos/eslint/eslint/labels/rule","name":"rule","color":"fbca04","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/eslint/eslint/pulls/10924/commits","review_comments_url":"https://api.github.com/repos/eslint/eslint/pulls/10924/comments","review_comment_url":"https://api.github.com/repos/eslint/eslint/pulls/comments{/number}","comments_url":"https://api.github.com/repos/eslint/eslint/issues/10924/comments","statuses_url":"https://api.github.com/repos/eslint/eslint/statuses/23d4197e3d96d3181d5b6b6690276cc13a6afaa9","head":{"label":"eslint:issue8308","ref":"issue8308","sha":"23d4197e3d96d3181d5b6b6690276cc13a6afaa9","user":{"login":"eslint","id":6019716,"node_id":"MDEyOk9yZ2FuaXphdGlvbjYwMTk3MTY=","avatar_url":"https://avatars3.githubusercontent.com/u/6019716?v=4","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,"node_id":"MDEwOlJlcG9zaXRvcnkxMTA2MTc3Mw==","name":"eslint","full_name":"eslint/eslint","private":false,"owner":{"login":"eslint","id":6019716,"node_id":"MDEyOk9yZ2FuaXphdGlvbjYwMTk3MTY=","avatar_url":"https://avatars3.githubusercontent.com/u/6019716?v=4","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},"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":"2018-10-18T03:18:41Z","pushed_at":"2018-10-17T23:59:45Z","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":"https://eslint.org","size":19338,"stargazers_count":12542,"watchers_count":12542,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":2160,"mirror_url":null,"archived":false,"open_issues_count":331,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":2160,"open_issues":331,"watchers":12542,"default_branch":"master"}},"base":{"label":"eslint:master","ref":"master","sha":"066f7e07d4f722573c6dbe7f64b0765504595644","user":{"login":"eslint","id":6019716,"node_id":"MDEyOk9yZ2FuaXphdGlvbjYwMTk3MTY=","avatar_url":"https://avatars3.githubusercontent.com/u/6019716?v=4","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,"node_id":"MDEwOlJlcG9zaXRvcnkxMTA2MTc3Mw==","name":"eslint","full_name":"eslint/eslint","private":false,"owner":{"login":"eslint","id":6019716,"node_id":"MDEyOk9yZ2FuaXphdGlvbjYwMTk3MTY=","avatar_url":"https://avatars3.githubusercontent.com/u/6019716?v=4","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},"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":"2018-10-18T03:18:41Z","pushed_at":"2018-10-17T23:59:45Z","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":"https://eslint.org","size":19338,"stargazers_count":12542,"watchers_count":12542,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":2160,"mirror_url":null,"archived":false,"open_issues_count":331,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":2160,"open_issues":331,"watchers":12542,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/eslint/eslint/pulls/10924"},"html":{"href":"https://github.com/eslint/eslint/pull/10924"},"issue":{"href":"https://api.github.com/repos/eslint/eslint/issues/10924"},"comments":{"href":"https://api.github.com/repos/eslint/eslint/issues/10924/comments"},"review_comments":{"href":"https://api.github.com/repos/eslint/eslint/pulls/10924/comments"},"review_comment":{"href":"https://api.github.com/repos/eslint/eslint/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/eslint/eslint/pulls/10924/commits"},"statuses":{"href":"https://api.github.com/repos/eslint/eslint/statuses/23d4197e3d96d3181d5b6b6690276cc13a6afaa9"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"mysticatea"}}