There's a new issue in ESLint 6.2.0 just caught by the standard test suite. Issue did not exist in ESLint 6.1.0.
Tell us about your environment
- ESLint Version: 6.2.0
- Node Version: 10.16.3
- npm Version: 6.9.0
What parser (default, Babel-ESLint, etc.) are you using? babel-eslint
Please show your full configuration:
Configuration
{
"parserOptions": {
"ecmaVersion": 2019,
"ecmaFeatures": {
"jsx": true
},
"sourceType": "module"
},
"parser": "babel-eslint",
"rules": {
"no-unused-vars": ["error", { "vars": "all", "args": "none", "ignoreRestSiblings": true }]
}
}
What did you do? Please include the actual source code causing the issue, as well as the command that you used to run ESLint.
function scoreAudioCoverFile (imgFile) {
const fileName = path.basename(imgFile.name, path.extname(imgFile.name)).toLowerCase()
const relevanceScore = {
cover: 80,
folder: 80,
album: 80,
front: 80,
back: 20,
spectrogram: -80
}
for (const keyword in relevanceScore) {
if (fileName === keyword) {
return relevanceScore[keyword]
}
if (fileName.indexOf(keyword) !== -1) {
return relevanceScore[keyword]
}
}
return 0
}
npx eslint --config eslintrc.json t.js
What did you expect to happen?
Just one error:
1:10 error 'scoreAudioCoverFile' is defined but never used no-unused-vars
What actually happened? Please include the actual, raw output from ESLint.
Two errors:
1:10 error 'scoreAudioCoverFile' is defined but never used no-unused-vars
12:14 error 'keyword' is defined but never used no-unused-vars
The variable keyword from the for-in loop is seen as not used.
This may be a bug in babel-eslint since the issue does not happen when the default parser is used. However, this issue did not exist with babel-eslint + 6.1.0 and does exist with babel-eslint + 6.2.0.
Issue opened on babel-eslint: babel/babel-eslint#791
Are you willing to submit a pull request to fix this bug?
Yes
There's a new issue in ESLint 6.2.0 just caught by the
standardtest suite. Issue did not exist in ESLint 6.1.0.Tell us about your environment
What parser (default, Babel-ESLint, etc.) are you using? babel-eslint
Please show your full configuration:
Configuration
What did you do? Please include the actual source code causing the issue, as well as the command that you used to run ESLint.
What did you expect to happen?
Just one error:
What actually happened? Please include the actual, raw output from ESLint.
Two errors:
The variable
keywordfrom the for-in loop is seen as not used.This may be a bug in
babel-eslintsince the issue does not happen when the default parser is used. However, this issue did not exist withbabel-eslint+ 6.1.0 and does exist withbabel-eslint+ 6.2.0.Issue opened on
babel-eslint: babel/babel-eslint#791Are you willing to submit a pull request to fix this bug?
Yes