{"action":"created","comment":{"url":"https://api.github.com/repos/eslint/eslint/pulls/comments/243641935","pull_request_review_id":187474308,"id":243641935,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDI0MzY0MTkzNQ==","diff_hunk":"@@ -88,6 +102,34 @@ module.exports = {\n                     }\n \n                     const endToken = sourceCode.getLastToken(node);\n+\n+                    /**\n+                     * If else block includes block scope local variable declaration [let or const],\n+                     * then it is not safe to remove else keyword [issue 11069]\n+                     */\n+                    const isDeclarationInside = sourceCode.getTokensBetween(startToken, endToken).findIndex(isVariableDeclaration) > -1;\n+\n+                    const childScopeVars = (childScopes, store = {}, level = 0) =>\n+                        childScopes.reduce((acc, block) => {\n+                            if (block.childScopes.length >= 0) {\n+                                acc[level] = block.variables;\n+                                let index = level + 1\n+                                return childScopeVars(block.childScopes, acc, index);\n+                            }\n+                            return acc\n+                        }, store)\n+\n+                    const shadowedVariables = scope => {\n+                        const result = childScopeVars(scope.childScopes);\n+                        return scope.variables.filter(elem => result[0].findIndex(vars => vars.name === elem.name) > -1)\n+                    };\n+                    const shadowed = shadowedVariables(context.getScope());\n+                    console.log('test', shadowed)\n+\n+                    if (isDeclarationInside) {","path":"lib/rules/no-else-return.js","position":49,"original_position":49,"commit_id":"0772a0ab327562215579b78e339916aff7cba21f","original_commit_id":"0772a0ab327562215579b78e339916aff7cba21f","user":{"login":"ajafff","id":11968040,"node_id":"MDQ6VXNlcjExOTY4MDQw","avatar_url":"https://avatars0.githubusercontent.com/u/11968040?v=4","gravatar_id":"","url":"https://api.github.com/users/ajafff","html_url":"https://github.com/ajafff","followers_url":"https://api.github.com/users/ajafff/followers","following_url":"https://api.github.com/users/ajafff/following{/other_user}","gists_url":"https://api.github.com/users/ajafff/gists{/gist_id}","starred_url":"https://api.github.com/users/ajafff/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ajafff/subscriptions","organizations_url":"https://api.github.com/users/ajafff/orgs","repos_url":"https://api.github.com/users/ajafff/repos","events_url":"https://api.github.com/users/ajafff/events{/privacy}","received_events_url":"https://api.github.com/users/ajafff/received_events","type":"User","site_admin":false},"body":"\"Block scoped declaration\" means `const`, `let` and `class` as they are not hoisted to the containing function.\r\n\r\n```ts\r\nlet foo = 1;\r\nfunction canNotBeFixed() {\r\n  if (condition) {\r\n    return foo;\r\n  } else {\r\n    let foo = 2; // else-block contains block scoped declaration, can not be fixed\r\n    console.log(foo);\r\n  }\r\n}\r\n\r\nfunction canBeFixed() {\r\n  if (condition) {\r\n    return foo;\r\n  } else {\r\n    {\r\n      let foo = 2; // block scoped declaration is not directly in else-block, but in a nested block\r\n      console.log(foo);\r\n    }\r\n  }\r\n}\r\n```","created_at":"2018-12-21T17:19:24Z","updated_at":"2018-12-21T17:19:25Z","html_url":"https://github.com/eslint/eslint/pull/11076#discussion_r243641935","pull_request_url":"https://api.github.com/repos/eslint/eslint/pulls/11076","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/eslint/eslint/pulls/comments/243641935"},"html":{"href":"https://github.com/eslint/eslint/pull/11076#discussion_r243641935"},"pull_request":{"href":"https://api.github.com/repos/eslint/eslint/pulls/11076"}},"in_reply_to_id":242042124},"pull_request":{"url":"https://api.github.com/repos/eslint/eslint/pulls/11076","id":229964920,"node_id":"MDExOlB1bGxSZXF1ZXN0MjI5OTY0OTIw","html_url":"https://github.com/eslint/eslint/pull/11076","diff_url":"https://github.com/eslint/eslint/pull/11076.diff","patch_url":"https://github.com/eslint/eslint/pull/11076.patch","issue_url":"https://api.github.com/repos/eslint/eslint/issues/11076","number":11076,"state":"open","locked":false,"title":"Fix: prevent fixing to incorrect code (fixes #11069)","user":{"login":"SerhiiBilyk","id":16646733,"node_id":"MDQ6VXNlcjE2NjQ2NzMz","avatar_url":"https://avatars0.githubusercontent.com/u/16646733?v=4","gravatar_id":"","url":"https://api.github.com/users/SerhiiBilyk","html_url":"https://github.com/SerhiiBilyk","followers_url":"https://api.github.com/users/SerhiiBilyk/followers","following_url":"https://api.github.com/users/SerhiiBilyk/following{/other_user}","gists_url":"https://api.github.com/users/SerhiiBilyk/gists{/gist_id}","starred_url":"https://api.github.com/users/SerhiiBilyk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SerhiiBilyk/subscriptions","organizations_url":"https://api.github.com/users/SerhiiBilyk/orgs","repos_url":"https://api.github.com/users/SerhiiBilyk/repos","events_url":"https://api.github.com/users/SerhiiBilyk/events{/privacy}","received_events_url":"https://api.github.com/users/SerhiiBilyk/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\nhttps://github.com/eslint/eslint/issues/11069\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\nI've add the function which checks if ELSE block includes block scope local variable declaration [let or const]\r\n\r\n**Is there anything you'd like reviewers to focus on?**\r\n\r\n\r\n","created_at":"2018-11-11T17:13:17Z","updated_at":"2018-12-21T17:19:25Z","closed_at":null,"merged_at":null,"merge_commit_sha":"28bda4e3d196e3ad2279bc338674072d2480551b","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":131106229,"node_id":"MDU6TGFiZWwxMzExMDYyMjk=","url":"https://api.github.com/repos/eslint/eslint/labels/accepted","name":"accepted","color":"0052cc","default":false},{"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/11076/commits","review_comments_url":"https://api.github.com/repos/eslint/eslint/pulls/11076/comments","review_comment_url":"https://api.github.com/repos/eslint/eslint/pulls/comments{/number}","comments_url":"https://api.github.com/repos/eslint/eslint/issues/11076/comments","statuses_url":"https://api.github.com/repos/eslint/eslint/statuses/0772a0ab327562215579b78e339916aff7cba21f","head":{"label":"SerhiiBilyk:issue11069","ref":"issue11069","sha":"0772a0ab327562215579b78e339916aff7cba21f","user":{"login":"SerhiiBilyk","id":16646733,"node_id":"MDQ6VXNlcjE2NjQ2NzMz","avatar_url":"https://avatars0.githubusercontent.com/u/16646733?v=4","gravatar_id":"","url":"https://api.github.com/users/SerhiiBilyk","html_url":"https://github.com/SerhiiBilyk","followers_url":"https://api.github.com/users/SerhiiBilyk/followers","following_url":"https://api.github.com/users/SerhiiBilyk/following{/other_user}","gists_url":"https://api.github.com/users/SerhiiBilyk/gists{/gist_id}","starred_url":"https://api.github.com/users/SerhiiBilyk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SerhiiBilyk/subscriptions","organizations_url":"https://api.github.com/users/SerhiiBilyk/orgs","repos_url":"https://api.github.com/users/SerhiiBilyk/repos","events_url":"https://api.github.com/users/SerhiiBilyk/events{/privacy}","received_events_url":"https://api.github.com/users/SerhiiBilyk/received_events","type":"User","site_admin":false},"repo":{"id":157100959,"node_id":"MDEwOlJlcG9zaXRvcnkxNTcxMDA5NTk=","name":"eslint","full_name":"SerhiiBilyk/eslint","private":false,"owner":{"login":"SerhiiBilyk","id":16646733,"node_id":"MDQ6VXNlcjE2NjQ2NzMz","avatar_url":"https://avatars0.githubusercontent.com/u/16646733?v=4","gravatar_id":"","url":"https://api.github.com/users/SerhiiBilyk","html_url":"https://github.com/SerhiiBilyk","followers_url":"https://api.github.com/users/SerhiiBilyk/followers","following_url":"https://api.github.com/users/SerhiiBilyk/following{/other_user}","gists_url":"https://api.github.com/users/SerhiiBilyk/gists{/gist_id}","starred_url":"https://api.github.com/users/SerhiiBilyk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SerhiiBilyk/subscriptions","organizations_url":"https://api.github.com/users/SerhiiBilyk/orgs","repos_url":"https://api.github.com/users/SerhiiBilyk/repos","events_url":"https://api.github.com/users/SerhiiBilyk/events{/privacy}","received_events_url":"https://api.github.com/users/SerhiiBilyk/received_events","type":"User","site_admin":false},"html_url":"https://github.com/SerhiiBilyk/eslint","description":"A fully pluggable tool for identifying and reporting on patterns in JavaScript","fork":true,"url":"https://api.github.com/repos/SerhiiBilyk/eslint","forks_url":"https://api.github.com/repos/SerhiiBilyk/eslint/forks","keys_url":"https://api.github.com/repos/SerhiiBilyk/eslint/keys{/key_id}","collaborators_url":"https://api.github.com/repos/SerhiiBilyk/eslint/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/SerhiiBilyk/eslint/teams","hooks_url":"https://api.github.com/repos/SerhiiBilyk/eslint/hooks","issue_events_url":"https://api.github.com/repos/SerhiiBilyk/eslint/issues/events{/number}","events_url":"https://api.github.com/repos/SerhiiBilyk/eslint/events","assignees_url":"https://api.github.com/repos/SerhiiBilyk/eslint/assignees{/user}","branches_url":"https://api.github.com/repos/SerhiiBilyk/eslint/branches{/branch}","tags_url":"https://api.github.com/repos/SerhiiBilyk/eslint/tags","blobs_url":"https://api.github.com/repos/SerhiiBilyk/eslint/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/SerhiiBilyk/eslint/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/SerhiiBilyk/eslint/git/refs{/sha}","trees_url":"https://api.github.com/repos/SerhiiBilyk/eslint/git/trees{/sha}","statuses_url":"https://api.github.com/repos/SerhiiBilyk/eslint/statuses/{sha}","languages_url":"https://api.github.com/repos/SerhiiBilyk/eslint/languages","stargazers_url":"https://api.github.com/repos/SerhiiBilyk/eslint/stargazers","contributors_url":"https://api.github.com/repos/SerhiiBilyk/eslint/contributors","subscribers_url":"https://api.github.com/repos/SerhiiBilyk/eslint/subscribers","subscription_url":"https://api.github.com/repos/SerhiiBilyk/eslint/subscription","commits_url":"https://api.github.com/repos/SerhiiBilyk/eslint/commits{/sha}","git_commits_url":"https://api.github.com/repos/SerhiiBilyk/eslint/git/commits{/sha}","comments_url":"https://api.github.com/repos/SerhiiBilyk/eslint/comments{/number}","issue_comment_url":"https://api.github.com/repos/SerhiiBilyk/eslint/issues/comments{/number}","contents_url":"https://api.github.com/repos/SerhiiBilyk/eslint/contents/{+path}","compare_url":"https://api.github.com/repos/SerhiiBilyk/eslint/compare/{base}...{head}","merges_url":"https://api.github.com/repos/SerhiiBilyk/eslint/merges","archive_url":"https://api.github.com/repos/SerhiiBilyk/eslint/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/SerhiiBilyk/eslint/downloads","issues_url":"https://api.github.com/repos/SerhiiBilyk/eslint/issues{/number}","pulls_url":"https://api.github.com/repos/SerhiiBilyk/eslint/pulls{/number}","milestones_url":"https://api.github.com/repos/SerhiiBilyk/eslint/milestones{/number}","notifications_url":"https://api.github.com/repos/SerhiiBilyk/eslint/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/SerhiiBilyk/eslint/labels{/name}","releases_url":"https://api.github.com/repos/SerhiiBilyk/eslint/releases{/id}","deployments_url":"https://api.github.com/repos/SerhiiBilyk/eslint/deployments","created_at":"2018-11-11T16:59:27Z","updated_at":"2018-11-11T16:59:33Z","pushed_at":"2018-12-14T08:09:34Z","git_url":"git://github.com/SerhiiBilyk/eslint.git","ssh_url":"git@github.com:SerhiiBilyk/eslint.git","clone_url":"https://github.com/SerhiiBilyk/eslint.git","svn_url":"https://github.com/SerhiiBilyk/eslint","homepage":"https://eslint.org","size":19543,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"eslint:master","ref":"master","sha":"e18c827cc12cb1c52e5d0aa993f572cb56238704","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-12-21T11:12:59Z","pushed_at":"2018-12-18T21:33:53Z","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":19697,"stargazers_count":12983,"watchers_count":12983,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":2232,"mirror_url":null,"archived":false,"open_issues_count":125,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":2232,"open_issues":125,"watchers":12983,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/eslint/eslint/pulls/11076"},"html":{"href":"https://github.com/eslint/eslint/pull/11076"},"issue":{"href":"https://api.github.com/repos/eslint/eslint/issues/11076"},"comments":{"href":"https://api.github.com/repos/eslint/eslint/issues/11076/comments"},"review_comments":{"href":"https://api.github.com/repos/eslint/eslint/pulls/11076/comments"},"review_comment":{"href":"https://api.github.com/repos/eslint/eslint/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/eslint/eslint/pulls/11076/commits"},"statuses":{"href":"https://api.github.com/repos/eslint/eslint/statuses/0772a0ab327562215579b78e339916aff7cba21f"}},"author_association":"NONE"}}
{"actor":{"display_login":"ajafff"}}