Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Fixed #826, Fixed #870 - Add Directive `jshint ignore`. #1260

Closed
wants to merge 3 commits into
from

Conversation

Projects
None yet
2 participants
Contributor

danielmiladinov commented Sep 8, 2013

This adds the ability to cause jshint to ignore either a block of lines
or just a single line.

You can can denote the start of an ignored block like this:

/*jshint ignore:start */

Lines inside an ignored block will be effectively invisible to the
linter. They aren't even presented to the lexer for tokenization.
This is ideal for blocking out sections of code that don't even remotely
resemble javascript, such as inline JSX

(http://facebook.github.io/react/docs/jsx-in-depth.html).

Similarly, you denote the end of an ignored block like this:

/*jshint ignore:end */

You can also ignore a single line with a trailing comment:

// jshint ignore:line

However, the use case presented for ignoring a single line seemed to be
more for silencing one or more warnings / errors in what was otherwise
valid javascript code (contrasted with JSX, which will never execute as
javascript without a transformation step to javascript). The linter will
still complain of errors if the lexer can't parse out the comment token.

danielmiladinov added some commits Sep 5, 2013

Fixed #826, Fixed #870 - Add Directive `jshint ignore`.
This adds the ability to cause jshint to ignore either a block of lines
or just a single line.

You can can denote the start of an ignored block like this:

/*jshint ignore:start */

Lines inside an ignored block will be effectively invisible to the
linter. They aren't even presented to the lexer for tokenization.
This is ideal for blocking out sections of code that don't even remotely
resemble javascript, such as inline JSX

(http://facebook.github.io/react/docs/jsx-in-depth.html).

Similarly, you denote the end of an ignored block like this:

/*jshint ignore:end */

You can also ignore a single line with a trailing comment:

// jshint ignore:line

However, the use case presented for ignoring a single line seemed to be
more for silencing one or more warnings / errors in what was otherwise
valid javascript code (contrasted with JSX, which will never execute as
javascript without a transformation step to javascript). The linter will
still complain of errors if the lexer can't parse out the comment token.
Owner

valueof commented Oct 17, 2013

Thanks! I've merged it into the 2.x branch (which reflects the current stable now) so your change will be out with the next release.

@valueof valueof closed this Oct 17, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment