I'm working on a React app created with Create React App. In every for...of loop, I get this weird 'no-unused-vars' warning pointing to the variable I have instantiated in the for statement.
ESLint tells me my variable is not used, but it is actually used.
Does anybody else get a similar warning? Is it an ESLint bug or am I doing something wrong here?
 This is not a big issue, but it is annoying.
 Thanks for your help.
   for (let track of tracks) {         let chords = RavelFormatter.splitEntries(track.pitches)         for (let chord of chords) {             var n = chord.split(':')             total += n.length         }     } Console output
  Line 13:  'track' is defined but never used       no-unused-vars   Line 15:  'chord' is defined but never used       no-unused-vars This rule is aimed at eliminating unused variables, functions, and function parameters. A variable foo is considered to be used if any of the following are true: It is called ( foo() ) or constructed ( new foo() ) It is read ( var bar = foo ) It is passed into a function as an argument ( doSomething(foo) )
Please upgrade the babel-eslint package to version 10.0.3.
This will most likely fix those false-positives where vars are used inside loops and wrongly reported as unused.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With