Search code examples
jqueryflexslidercodekit

Codekit: Best practice to not jHint parts of code


What the best way to omit a block of code from being checked (by jHint) in Codekit.

The direct example is that I and using FlexSlider which when I paste the provided code from the tutorial page: http://flexslider.woothemes.com/video.html I get a bunch of errors.

I still want the rest of my code to be jHinted just not the stuff that I didn't write.


Solution

  • From JSHint's documentation:

    ignore

    A directive for telling JSHint to ignore a block of code.

    // Code here will be linted with JSHint.
    /* jshint ignore:start */
    // Code here will be linted with ignored by JSHint.
    /* jshint ignore:end */
    

    All code in between ignore:start and ignore:end won't be passed to JSHint so you can use any language extension such as Facebook React. Additionally, you can ignore a single line with a trailing comment:

    ignoreThis(); // jshint ignore:line