javascript: Configuration for rule "no-else-return" is invalid
I get this error on save with atom. I’ve tried to fiddle around with versions and re-install everything. Looks like there is a bad config option in the eslint-config-airbnb-base.
node_modules/eslint-config-airbnb-base/rules/best-practices.js: Configuration for rule "no-else-return" is invalid: Value "[object Object]" should NOT have more than 0 items.
The rule in best-practices.js looks like this:
// disallow else after a return in an if
// https://eslint.org/docs/rules/no-else-return
// TODO: semver-major, set allowElseIf to false
'no-else-return': ['error', { allowElseIf: true }],
My dependencies:
"devDependencies": {
"babel-eslint": "^8.0.1",
"eslint": "^4.9.0",
"eslint-config-airbnb": "^16.1.0",
"eslint-plugin-import": "^2.7.0",
"eslint-plugin-jsx-a11y": "^6.0.2",
"eslint-plugin-meteor": "^4.1.4",
"eslint-plugin-react": "^7.4.0"
},
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 8
- Comments: 16
I got this exact error today, this should be reopen, here is my eslint config:
And I get the error while building the project:
The option was added in eslint 4.9. Probably your atom-plugin uses an outdated version of eslint.
Ah, yes it’s almost always a problem with gulp-eslint not updating fast enough 😃 I’m quite sure if you check
npm ls
you’ll see gulp-eslint brings in an outdated eslint.I had just encountered the same issue. Solved it by upgrading the version of eslint to
4.9.0
While that’s a lot of warnings that should be errors, it seems like the issue is that you’re somehow not using eslint 4.9+. Are you sure you have 4.9 installed locally, and that vscode is using the local one? Can you
npm uninstall -g eslint
just in case?All editors, but Atom in particular, are very brittle, and need a restart whenever anything in node_modules changes.
I had the same problem with VSCode (which takes the eslint version it finds in the project). The issue seemed to be this one Linting doesn’t update after ESLint package upgrade.
So I restarted VSCode and it worked again. Maybe it solves the problem for atom as well?