Is it possible to ignore files in jshint when running gulp --production?

I added modernizr back in via manifest.json, and its causing problems when I run gulp or gulp --production

line 4 col 2955 Too many errors. (80% scanned).

:heavy_multiplication_x: 1 error
:warning: 50 warnings

[12:35:54] ‘jshint’ errored after 117 ms
[12:35:54] Error in plugin ‘gulp-jshint’
Message:
JSHint failed for: assets/scripts/vendor/modernizr-2.8.3.min.js
[12:35:54] ‘build’ errored after 1.74 s
[12:35:54] Error in plugin ‘run-sequence’
Message:
An error occured in task ‘jshint’.

removing modernizr from manifest.json allows --production to run fine, so it there any way to ignore modernizr in this task?

Thanks!

You can ignore the file by adding

/* jshint ignore:start */

at the beginning of the file.

I just did this myself by manually adding an excluded file in gulpfile.js here: https://github.com/roots/sage/blob/93da15b03d44e2122699c285a75e4a9a113ea17b/gulpfile.js#L227-L234

Example:

gulp.task('jshint', function() {
  return gulp.src([
    'bower.json', 'gulpfile.js'
  ].concat(project.js)
  .concat('!assets/scripts/plugins/**'))
    .pipe($.jshint())
    .pipe($.jshint.reporter('jshint-stylish'))
    .pipe($.jshint.reporter('fail'));
});

! means exclude.

9 Likes

How would this be applied to sage 9 with webpack?

Just ran into the same issue…

Place /* eslint-disable */ at the start of the little troublemaker and feel safe ignoring all the errors :innocent:

3 Likes

This isn’t working for me, anything else I can try?