Richard
Richard

Reputation: 65510

Exclude a subdirectory from JSHint in my Gruntfile?

I am running JSHint automatically from a Gruntfile, and would like to exclude my vendor scripts, since lots of them fail JSHint.

How can I do this? At the moment I am running JSHint across anything in /app/scripts/ or any subdirectories.

jshint: {
  options: {
    jshintrc: '.jshintrc',
    reporter: require('jshint-stylish')
  },
  all: [
    'Gruntfile.js',
    '<%= yeoman.app %>/scripts/{,*/}*.js' 
  ]
},

I would like to exclude anything in /app/scripts/vendor. Is this possible?

Upvotes: 11

Views: 7764

Answers (1)

Ben
Ben

Reputation: 10146

Just prefix the path with ! to tell minimatch that it is an exclusion; note when doing this order is important.

jshint: {
  options: {
    jshintrc: '.jshintrc',
    reporter: require('jshint-stylish')
  },
  all: [
    'Gruntfile.js',
    '<%= yeoman.app %>/scripts/{,*/}*.js',
    '!<%= yeoman.app %>/scripts/vendor/**',
  ]
},

Upvotes: 31

Related Questions