{"action":"created","issue":{"url":"https://api.github.com/repos/eslint/eslint/issues/3104","labels_url":"https://api.github.com/repos/eslint/eslint/issues/3104/labels{/name}","comments_url":"https://api.github.com/repos/eslint/eslint/issues/3104/comments","events_url":"https://api.github.com/repos/eslint/eslint/issues/3104/events","html_url":"https://github.com/eslint/eslint/issues/3104","id":96313003,"number":3104,"title":"rule prefer-const not usable for for-loop variable","user":{"login":"hasenstein","id":199179,"avatar_url":"https://avatars.githubusercontent.com/u/199179?v=3","gravatar_id":"","url":"https://api.github.com/users/hasenstein","html_url":"https://github.com/hasenstein","followers_url":"https://api.github.com/users/hasenstein/followers","following_url":"https://api.github.com/users/hasenstein/following{/other_user}","gists_url":"https://api.github.com/users/hasenstein/gists{/gist_id}","starred_url":"https://api.github.com/users/hasenstein/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hasenstein/subscriptions","organizations_url":"https://api.github.com/users/hasenstein/orgs","repos_url":"https://api.github.com/users/hasenstein/repos","events_url":"https://api.github.com/users/hasenstein/events{/privacy}","received_events_url":"https://api.github.com/users/hasenstein/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/eslint/eslint/labels/question","name":"question","color":"cc317c"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2015-07-21T13:20:08Z","updated_at":"2015-07-21T16:13:10Z","closed_at":null,"body":"eslint 0.24.1\r\n\r\neslintrc: https://gist.github.com/hasenstein/004514113cb2eaf8d772\r\n\r\nEven the example on http://eslint.org/docs/rules/prefer-const.html\r\n\r\n<blockquote>The following patterns are considered warnings:</blockquote>\r\n\r\n    for (let i in [1,2,3]) { // `i` is re-defined (not modified) on each loop step.\r\n        console.log(i);\r\n    }\r\n\r\ndoes not work when I use const (I tried with io.js):\r\n\r\n    for (const i in [1,2,3]) { // `i` is re-defined (not modified) on each loop step.\r\n    ...     console.log(i);\r\n    ... }\r\n    TypeError: Identifier 'i' has already been declared at repl:1:1\r\n    at REPLServer.defaultEval (repl.js:154:27)\r\n    at bound (domain.js:254:14)\r\n    at REPLServer.runBound [as eval] (domain.js:267:12)\r\n    at REPLServer.<anonymous> (repl.js:308:12)\r\n    at emitOne (events.js:77:13)\r\n    at REPLServer.emit (events.js:169:7)\r\n    at REPLServer.Interface._onLine (readline.js:210:10)\r\n    at REPLServer.Interface._line (readline.js:549:8)\r\n    at REPLServer.Interface._ttyWrite (readline.js:826:14)\r\n\r\nI find that weird given that the loop indeed behaves as if the variable is created fresh within the loop block but so it is..."},"comment":{"url":"https://api.github.com/repos/eslint/eslint/issues/comments/123388099","html_url":"https://github.com/eslint/eslint/issues/3104#issuecomment-123388099","issue_url":"https://api.github.com/repos/eslint/eslint/issues/3104","id":123388099,"user":{"login":"Canop","id":617006,"avatar_url":"https://avatars.githubusercontent.com/u/617006?v=3","gravatar_id":"","url":"https://api.github.com/users/Canop","html_url":"https://github.com/Canop","followers_url":"https://api.github.com/users/Canop/followers","following_url":"https://api.github.com/users/Canop/following{/other_user}","gists_url":"https://api.github.com/users/Canop/gists{/gist_id}","starred_url":"https://api.github.com/users/Canop/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Canop/subscriptions","organizations_url":"https://api.github.com/users/Canop/orgs","repos_url":"https://api.github.com/users/Canop/repos","events_url":"https://api.github.com/users/Canop/events{/privacy}","received_events_url":"https://api.github.com/users/Canop/received_events","type":"User","site_admin":false},"created_at":"2015-07-21T16:13:10Z","updated_at":"2015-07-21T16:13:10Z","body":"This only happens when the code is run in non strict mode, which is the correct behavior."}}