I can 100% get behind something like this. I’m thinking we should probably consider if this check can be applied in general to all exercises, but it might need some rework to get there.
My motivation is that I’ve often seen solutions that just leave the placeholder throw after the return and it’s definitely not a good practice to be teaching.
Cool-Katt’s idea is a sound one about flagging an unreachable placeholder throw. I see that fairly regularly when mentoring JS solutions, and that would be handled nicely by the analyzer.
That case would be nice to flag. That case is not the code in the original post nor would it be handled by the OP’s PR, though. My comment was about what the OP mentioned and PRed.
Having the analyzer detect unreachable code (even if it is only a very specific line of unreachable code) would definitely be nice, though!
Yes, that and the information you already provided that the analyzer only needs to consider passing solutions should be it.
Dead code detection would be awesome, but what’s already good enough is to see if the stub throw is present. I think we wanted to normalize the error message in JS (right @Cool-Katt ?) So the check would be really easy.