{"action":"created","issue":{"url":"https://api.github.com/repos/eslint/eslint/issues/5822","repository_url":"https://api.github.com/repos/eslint/eslint","labels_url":"https://api.github.com/repos/eslint/eslint/issues/5822/labels{/name}","comments_url":"https://api.github.com/repos/eslint/eslint/issues/5822/comments","events_url":"https://api.github.com/repos/eslint/eslint/issues/5822/events","html_url":"https://github.com/eslint/eslint/issues/5822","id":147586219,"number":5822,"title":"`prefer-const` rule warns when \"let\" is needed for scoping","user":{"login":"ljharb","id":45469,"avatar_url":"https://avatars.githubusercontent.com/u/45469?v=3","gravatar_id":"","url":"https://api.github.com/users/ljharb","html_url":"https://github.com/ljharb","followers_url":"https://api.github.com/users/ljharb/followers","following_url":"https://api.github.com/users/ljharb/following{/other_user}","gists_url":"https://api.github.com/users/ljharb/gists{/gist_id}","starred_url":"https://api.github.com/users/ljharb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ljharb/subscriptions","organizations_url":"https://api.github.com/users/ljharb/orgs","repos_url":"https://api.github.com/users/ljharb/repos","events_url":"https://api.github.com/users/ljharb/events{/privacy}","received_events_url":"https://api.github.com/users/ljharb/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/eslint/eslint/labels/triage","name":"triage","color":"cc317c"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-04-11T23:32:47Z","updated_at":"2016-04-11T23:43:52Z","closed_at":null,"body":"on eslint v2.7.0.\r\n\r\n`echo 'let foo; const bar = function bar() { return foo; }; foo = 3; console.log(bar());' | ./node_modules/.bin/eslint --stdin --rule 'prefer-const: 2' --no-eslintrc --parser-options=ecmaVersion:6`\r\ngives\r\n```sh\r\n<text>\r\n  1:54  error  'foo' is never reassigned, use 'const' instead  prefer-const\r\n\r\n✖ 1 problem (1 error, 0 warnings)\r\n```\r\n\r\nI'd like it not to warn here, since the `let` is required to be able to refer to it without violating the `no-use-before-define` rule. If it does warn, then must I disable one of the rules since they are in conflict here?"},"comment":{"url":"https://api.github.com/repos/eslint/eslint/issues/comments/208621832","html_url":"https://github.com/eslint/eslint/issues/5822#issuecomment-208621832","issue_url":"https://api.github.com/repos/eslint/eslint/issues/5822","id":208621832,"user":{"login":"platinumazure","id":284282,"avatar_url":"https://avatars.githubusercontent.com/u/284282?v=3","gravatar_id":"","url":"https://api.github.com/users/platinumazure","html_url":"https://github.com/platinumazure","followers_url":"https://api.github.com/users/platinumazure/followers","following_url":"https://api.github.com/users/platinumazure/following{/other_user}","gists_url":"https://api.github.com/users/platinumazure/gists{/gist_id}","starred_url":"https://api.github.com/users/platinumazure/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/platinumazure/subscriptions","organizations_url":"https://api.github.com/users/platinumazure/orgs","repos_url":"https://api.github.com/users/platinumazure/repos","events_url":"https://api.github.com/users/platinumazure/events{/privacy}","received_events_url":"https://api.github.com/users/platinumazure/received_events","type":"User","site_admin":false},"created_at":"2016-04-11T23:43:52Z","updated_at":"2016-04-11T23:43:52Z","body":"Why not do `const foo = 3;` at the beginning?\r\n\r\nOr if, as I suspect, this is a simplified use case, could you please post your actual use case?"}}