Skip to content
This repository has been archived by the owner on Aug 18, 2021. It is now read-only.

Comments

@feross
Copy link

feross commented Aug 18, 2019

There's a new issue in ESLint 6.2.0 just caught by the standard test suite. This may be an issue with babel-eslint, though I am not sure since the issue did not exist in ESLint 6.1.0. Here's a pointer to the issue I filed with ESLint: eslint/eslint#12117

@yyfearth
Copy link

Seems the eslint-scope is outdated for the latest eslint.

fetus-hina added a commit to fetus-hina/stat.ink that referenced this issue Aug 19, 2019
if update it to v6.2.0, following code doesn't pass ESLint

```js
const list = ['a', 'b', 'c'];
for (const i in list) { // <- no-unused-vars "error 'i' is defined but never used"
  console.log(i);       // <- WE USE IT IN THIS LINE!!!!!!
}
```

See:
  https://twitter.com/fetus_hina/status/1163416507138768896
  https://twitter.com/fetus_hina/status/1163417546676039681
  https://twitter.com/fetus_hina/status/1163421886543323136
  #550
  eslint/eslint#12117
  babel/babel-eslint#791
@jharris4
Copy link

FYI I tried upgrading eslint-scope to latest on my fork of this package, and the false positives are still happening.

@DullReferenceException
Copy link

DullReferenceException commented Aug 19, 2019

Maybe related, having the same problem with for..of loops:

import scenarios from './scenarios';

for (const scenario of scenarios) {
  doSomethingWithScenario(scenario);
}

Get an eslint error:

'scenario' is defined but never used. eslint(no-unused-vars)

With [email protected] and [email protected].

[email protected] works.

@yyfearth
Copy link

According to the original eslint issue eslint/eslint#12117

Most likely it is that commit, with babel-eslint in the keyword example there is a TDZ scope between function and for, probably because it's using the old version of eslint-scope

@feross
Copy link
Author

feross commented Aug 22, 2019

Just wanted to note that ESLint 6.2.1 contains an important security fix (see: https://eslint.org/blog/2019/08/eslint-v6.2.1-released) but it's not possible to upgrade to 6.2.0 or later until this issue is fixed.

@JLHwung
Copy link
Contributor

JLHwung commented Aug 23, 2019

For those who are curious about why ESLint 6.2 + babel-eslint does not work and how we may solve it on babel-eslint side, I have written a bit on #793 (comment).

@hzoo
Copy link
Member

hzoo commented Aug 25, 2019

Ok merged #794 thanks to everyone and @JLHwung for the PR, released as 10.0.3. Not an easy package to maintain for sure given it's patching the packages themselves. Ideally we'll have better hooks for these things in the future.

Can also do one for v11 beta.

I verifed with one of the test cases on 10.0.2 and it failing and passing with 10.0.3. Let us know if this issue still persists! Thanks!

This was referenced Jun 6, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.