question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Configuration for rule "no-else-return" is invalid

See original GitHub issue

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"
  },

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:8
  • Comments:16

github_iconTop GitHub Comments

7reactions
lednhatkhanhcommented, Dec 20, 2017

I got this exact error today, this should be reopen, here is my eslint config:

{
	"parser": "babel-eslint",
	"env": {
		"browser": true,
		"jest": true,
		"node": true
	},
	"extends": ["airbnb", "prettier"],
	"plugins": ["prettier"],
	"rules": {
		"prettier/prettier": "error",
		"react/jsx-indent": 0,
		"no-else-return": 0
	}
}

And I get the error while building the project:

Module build failed: Error: C:\Users\klnhat\code\my-book-list\client-my-book-list\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.

Referenced from: C:\Users\klnhat\code\my-book-list\client-my-book-list\node_modules\eslint-config-airbnb-base\index.js
Referenced from: C:\Users\klnhat\code\my-book-list\client-my-book-list\node_modules\eslint-config-airbnb\index.js
Referenced from: C:\Users\klnhat\code\my-book-list\client-my-book-list\.eslintrc
    at Array.forEach (<anonymous>)
    at Array.reduceRight (<anonymous>)
    at Array.reduceRight (<anonymous>)
4reactions
thomaskleincommented, Oct 18, 2017

The option was added in eslint 4.9. Probably your atom-plugin uses an outdated version of eslint.

Read more comments on GitHub >

github_iconTop Results From Across the Web

no-else-return - ESLint - Pluggable JavaScript Linter
This rule is aimed at highlighting an unnecessary block of code following an if containing a return statement. As such, it will warn...
Read more >
eslint/eslint - Gitter
I want to use global eslint config and globally installed plugins, ... for rule "no-else-return" is invalid: Value "[object Object]" should NOT have...
Read more >
javascript - Unnecessary 'else' after 'return'. (No-else-return)
What that is basically saying is that the else part of the if statement is unnecessary if there is a return in the...
Read more >
eslintrc.json - Google Git
"no-template-curly-in-string": "error",. "valid-jsdoc": "error",. // Best Practices ... "no-else-return": "error", ... "no-invalid-this": "off",.
Read more >
eslint-config-nicestyle - npm package - Snyk
Learn more about eslint-config-nicestyle: package health score, popularity, ... A proposal of style and rules for javascript. ... no-else-return, error.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found