Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: for-of loop (no-unused-vars) #12165

Closed
shoonia opened this issue Aug 25, 2019 · 1 comment
Closed

Bug: for-of loop (no-unused-vars) #12165

shoonia opened this issue Aug 25, 2019 · 1 comment
Labels
archived due to age This issue has been archived; please open a new issue for any further discussion bug ESLint is working incorrectly triage An ESLint team member will look at this issue soon

Comments

@shoonia
Copy link

shoonia commented Aug 25, 2019

Eslint says the const and let declared into for-of loop brackets never used.

Environment

  • ESLint: v6.2.2
  • Node: v10.13.0
  • yarn: v1.12.3

babel-eslint with eslint:recommended

Configuration:

Configuration
{
  "parser": "babel-eslint",
  "extends": [
    "eslint:recommended"
  ],
  "parserOptions": {
    "ecmaVersion": 2018
  },
  "env": {
    "es6": true,
    "node": true,
    "browser": true,
    "mocha": true
  },
  "rules": {
    "linebreak-style": "off",
    "indent": [
      "error",
      2
    ],
    "quotes": [
      "error",
      "double"
    ],
    "semi": [
      "error",
      "always"
    ]
  }
}
const arr = [1, 2, 3];

for (const key1 of arr) {
  console.log(key1);
}

for (let key2 of arr) {
  console.log(key2);
}
yarn run v1.12.3
$ eslint . --fix

D:\projects\mini-css-class-name\es6\test.js
  3:12  error  'key1' is defined but never used  no-unused-vars
  7:10  error  'key2' is defined but never used  no-unused-vars

✖ 2 problems (2 errors, 0 warnings)

It works without errors in previous eslint v6.1.0

@shoonia shoonia added bug ESLint is working incorrectly triage An ESLint team member will look at this issue soon labels Aug 25, 2019
@shoonia shoonia changed the title for-of loop (no-unused-vars) Bug: for-of loop (no-unused-vars) Aug 25, 2019
@mdjermanovic
Copy link
Member

Hi @shoonia, thanks for the issue.

I'm closing this because it's a duplicate of #12117.

Please follow #12117 and babel/babel-eslint#791

@eslint-deprecated eslint-deprecated bot locked and limited conversation to collaborators Feb 22, 2020
@eslint-deprecated eslint-deprecated bot added the archived due to age This issue has been archived; please open a new issue for any further discussion label Feb 22, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
archived due to age This issue has been archived; please open a new issue for any further discussion bug ESLint is working incorrectly triage An ESLint team member will look at this issue soon
Projects
None yet
Development

No branches or pull requests

2 participants