Exclude file paths from jshint with gulp

If you want to jshint all JavaScript files in a folder, but want to exclude a subfolder, you can use “negation” in gulp.

 

 

var gulp = require("gulp");

var jshint = require("gulp-jshint");
var plumber = require("gulp-plumber");

 

var onError = function (err) {
        console.log(err);
    };

/**
     * Hint all of our custom developed Javascript files.
     */
    gulp.task("jshint", function () {

        return gulp.src([
            "Client/**/*.js",
           "!Client/Libraries/**/*.js"
        ])
        .pipe(plumber({
            errorHandler: onError
        }))
        .pipe(jshint())
        .pipe(jshint.reporter("default"));
    });

Leave a Reply

Your email address will not be published. Required fields are marked *