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.

[change] Only report first instance of unreachable code

See original GitHub issue

In ESLint 2.11.1 (bundled with Atom linter-eslint), the error for no-unreachable marks every single line of code after the return statement. Maybe this is redundant and it should only mark the first instance of unreachable code? It’s pretty obvious that everything after that line will also be unreachable.

Illustration:

image

Perhaps we could control this via a flag/setting, in case some people do prefer to have every line marked.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:15 (11 by maintainers)

github_iconTop GitHub Comments

1reaction
nzakascommented, Jul 20, 2016

Assuming that @markelog’s “SGTM” is the same as 👍, marking as accepted.

0reactions
adamreisnzcommented, Jul 23, 2016

Thanks guys 🎉

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unreachable code error vs. dead code warning in Java under ...
Only triggers a "Dead code" warning? The only explanation I can think of is that the Java compiler only flags the first, and...
Read more >
Warning: unreachable code after return statement - JavaScript
When an expression exists after a valid return statement, a warning is given to indicate that the code after the return statement is...
Read more >
Unreachable Code Error in Java - GeeksforGeeks
The Unreachable statements refers to statements that won't get executed during the execution of the program are called Unreachable ...
Read more >
Unreachable code - MathWorks
Unreachable code uses statement coverage to determine whether a section of code can be reached during execution.
Read more >
Should unreachable-code be an error or warning? · Issue #2378
The specification states in multiple places that unreachable statements should be an error. This is mostly clearly described in the behavior ...
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