The "Nested comment" error is thrown when JSLint encounters the character sequence /*
inside a multiline comment. Here's an example:
/* This is a multiline comment.
/* It's valid JavaScript,
but JSLint doesn't like it */
This error is raised to highlight a potentially dangerous piece of code.
While it is valid to include the /*
sequence in a multiline comment, it is not
valid to include */
. If you were to do so, everything following the first */
would be parsed as if it is not part of the comment. Here's an example (notice
the syntax highlighting which demonstrates the error):
/* This is a multiline comment.
/* It's valid JavaScript, */
but JSLint doesn't like it */
You can resolve this issue by simply removing /*
character sequences from multiline comments:
/* This is a multiline comment.
It's valid JavaScript,
but JSLint doesn't like it */