-1

I had confusion between options and error/warning code in jshint.

curly : true

or

W116

How to identify "curly options" belongs to W116 Code?

 while(true)
            alert("ok");

demo.js: line 3, col 5, Expected '{' and instead saw 'alert'.(W116)

Please let me know, If my question is not clear.

  • The options there are generally broad and cover a variety of cases, while the specific warning codes are only for very specific cases, which can be sometimes helpful. – Qantas 94 Heavy Nov 13 '13 at 12:34

1 Answers1

1

Update

And if you really want to know what error codes belong to what options, I guess you'll have to dive in the source code here..

But usually the documentation should be enough, curly option:

This option requires you to always put curly braces around blocks in loops and conditionals. JavaScript allows you to omit curly braces when the block consists of only one statement, for example:

while (day)
    shuffle();

However, in some circumstances, it can lead to bugs (you'd think that sleep() is a part of the loop while in reality it is not):

while (day)
    shuffle();
    sleep();

Also, if sometimes you wonder what an error code corresponds to, check this file:

messages.js

So in your case:

messages.js#L189

eightyfive
  • 4,601
  • 3
  • 35
  • 44