Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can you trigger the "What the hell is this?" JSLint message?

JSLint has some interesting messages, such as eval is evil. when you use an eval statement, and Weird relation. when comparing two literals, e.g. 1 == 2.

I was looking through a list of the JSLint messages, and noticed this one at the bottom of the list:

What the hell is this?

I looked through the JSLint source and found this code:

if (stack.length === 0) {
    error("What the hell is this?", nexttoken);
}

I have been trying for a while, unsuccessfully, to write code that triggers this. Nothing I have read about JSLint talks about this error message, why it exists, or what causes it. I've briefly inspected the code, but I can't really understand what the stack is, how it is populated or what could cause it to be empty.

Can somebody write a code sample that will cause JSLint to scream What the hell is this? or explain what prevents this from happening?

like image 928
Peter Olson Avatar asked Oct 11 '11 17:10

Peter Olson


2 Answers

It looks a lot like a "can't happen" check (a form of defensive programming). If so, there might not be any way to trigger it in practice.

like image 139
Ilmari Karonen Avatar answered Oct 19 '22 12:10

Ilmari Karonen


Looks like the error message is no longer there in the message list or source code.

like image 1
Alex Avatar answered Oct 19 '22 11:10

Alex