eslint: no-else-return doesn't trigger for else if.

Tell us about your environment

  • ESLint Version: 4.6.1
  • Node Version: 8.4.0
  • npm Version: 5.3.0

What parser (default, Babel-ESLint, etc.) are you using? see config Please show your full configuration: see eslint demo URLs. What did you do? Please include the actual source code causing the issue.

const res = (() => {
  if (error) {
    return 'It failed';
  } else if (loading) {
    return "It's still loading";
  }

  return result;
})();

What did you expect to happen?

no-else-return should trigger.

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

no-else-return did not trigger.

Demo urls:

doesn’t detect error does detect error

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 16 (16 by maintainers)

Commits related to this issue

Most upvoted comments