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.

no-else-return rule issue

See original GitHub issue

Tell us about your environment

  • ESLint Version: 4.9.0
  • Node Version: 8.6.0
  • npm Version: 5.4.2

What parser (default, Babel-ESLint, etc.) are you using? Default

Please show your full configuration:

Configuration
{
  "extends": [
    "airbnb"
  ],
  "globals": {
    "fetch": false
  },
  "rules": {
    "indent": ["error", 4, {"SwitchCase": 1}],
    "react/jsx-indent": ["error", 4],
    "quote-props": "off",
    "react/sort-comp": 1,
    "func-names": 1,
    "object-shorthand": 1,
    "object-curly-newline": 1,
    "arrow-parens": 1,
    "default-case": 0,
    "prefer-const": 1,
    "space-before-function-paren": 1,
    "max-len": ["warn", 100],
    "prefer-template": 1,
    "consistent-return": 1,
    "global-require": 1,
    "vars-on-top": 1,
    "function-paren-newline": 1,
    "prefer-arrow-callback": 1,
    "spaced-comment": 1,
    "prefer-destructuring": 1,
    "prefer-promise-reject-errors": 1,
    "prefer-spread": 1,
    "radix": 1,
    "dot-notation": 1,
    "one-var": 1,
    "one-var-declaration-per-line": 1,
    "operator-assignment": 1,
    "array-callback-return": 1,
    "wrap-iife": 1,
    "guard-for-in": 1,
    "strict": 1,
    "lines-around-directive": 1,
    "no-prototype-builtins": 1,
    "no-useless-concat": 1,
    "no-restricted-syntax": 1,
    "no-restricted-globals": 1,
    "no-multi-assign": 1,
    "no-confusing-arrow": ["warn", {"allowParens": true}],
    "no-use-before-define": 1,
    "no-empty": 1,
    "no-mixed-operators": 1,
    "no-var": 1,
    "no-unused-vars": 1,
    "no-unused-expressions": 1,
    "no-param-reassign": 1,
    "no-useless-return": 1,
    "no-nested-ternary": 1,
    "no-shadow": 1,
    "no-lonely-if": 1,
    "no-undef": 1,
    "no-case-declarations": 1,
    "no-underscore-dangle": 1,
    "no-plusplus": 1,
    "no-else-return": 1,
    "no-bitwise": 1,
    "class-methods-use-this": ["warn", {"exceptMethods": []}],
    "array-bracket-spacing": ["warn", "never"],
    "arrow-body-style": ["warn", "as-needed"],
    "linebreak-style": ["warn", "unix"],
    "import/extensions": [1, "never", {"js": "never", "jsx": "never"}],
    "import/no-extraneous-dependencies": 1,
    "import/no-unresolved": 1,
    "import/no-mutable-exports": 1,
    "import/first": 1,
    "import/newline-after-import": 1,
    "import/prefer-default-export": 1,
    "jsx-quotes": ["warn", "prefer-single"],
    "react/react-in-jsx-scope": 1,
    "react/jsx-indent-props": ["error", 4],
    "react/jsx-first-prop-new-line": ["warn", "multiline-multidrop"],
    "react/jsx-closing-bracket-location": ["warn", "line-aligned"],
    "react/jsx-closing-tag-location": 1,
    "react/no-string-refs": 1,
    "react/no-unused-prop-types": 1,
    "react/no-children-prop": 1,
    "react/no-find-dom-node": 1,
    "react/no-array-index": 1,
    "react/require-default-props": 1,
    "react/jsx-no-bind": 1,
    "react/jsx-curly-brace-presence": ["warn", {"props": "never", "children": "never"}],
    "react/forbid-prop-types": ["warn", {"forbid": ["any", "array", "object"]}],
    "react/no-unescaped-entities": 1,
    "react/no-unused-state": 1,
    "react/no-array-index-key": 1,
    "react/no-did-mount-set-state": 1,
    "react/no-did-update-set-state": 1,
    "react/jsx-no-target-blank": 1,
    "react/jsx-wrap-multilines": 1,
    "jsx-a11y/no-noninteractive-element-interactions": 1,
    "jsx-a11y/click-events-have-key-events": 1,
    "jsx-a11y/label-has-for": 1,
    "jsx-a11y/alt-text": 1,
    "jsx-a11y/no-static-element-interactions": 1,
    "jsx-a11y/anchor-is-valid": 1,
    "jsx-a11y/no-redundant-roles": 1,
    "jsx-a11y/scope": 1,
    "jsx-a11y/interactive-supports-focus": 1,
    "comma-dangle": 0
  }
}

What did you do? Please include the actual source code causing the issue. Issue caused by eslint-config-airbnb-base@12.1.0 node_modules/eslint-config-airbnb-base/rules/best-practices.js:62

'no-else-return': ['error', { allowElseIf: true }],

What did you expect to happen? Run without error

What actually happened? Please include the actual, raw output from ESLint.

events.js:182 throw er; // Unhandled ‘error’ event ^ Error: /home/zakhargulchak/WebstormProjects/application-ngo2/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.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:15 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
aladdin-addcommented, Oct 24, 2017

we have added eslint version to error output (https://github.com/eslint/eslint/pull/9071), but seems not ideal. I was wondering adding version before every eslint running.

thanks for the reporting!

1reaction
zakhar-gulchakcommented, Oct 23, 2017

Found problem.

├─┬ gulp-eslint@4.0.0
│ ├── eslint@4.8.0

Gulp-eslint is using own dependency. And not the latest version.

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 >
javascript - Unnecessary 'else' after 'return'. (No-else-return)
While the rule correctly points out that the else block is unnecessary, and it is a style preference, I would add additional considerations ......
Read more >
no-else-return : else if · Issue #3015 · eslint/eslint - GitHub
The final else is considered a violation -- which makes technical sense given the implementation, but seems contrary to the intent of the...
Read more >
Disallow return before else (no-else-return) - ESLint
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 >
Enable the "no-else-return" rule in pylint and fix the existing ...
Hello, I have previously submitted a few one-line patches to Mozilla, but that was in C++, and not in the "Lint and Formatting"...
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