[change] Only report first instance of unreachable code
See original GitHub issueIn 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:
Perhaps we could control this via a flag/setting, in case some people do prefer to have every line marked.
Issue Analytics
- State:
- Created 7 years ago
- Comments:15 (11 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Assuming that @markelog’s “SGTM” is the same as 👍, marking as accepted.
Thanks guys 🎉