Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Exclude a subdirectory from JSHint in my Gruntfile?

Tags:

gruntjs

jshint

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?

like image 458
Richard Avatar asked Nov 21 '13 21:11

Richard


1 Answers

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/**',
  ]
},
like image 161
Ben Avatar answered Sep 19 '22 06:09

Ben