grunt-contrib-jshint ignores has no effect

▼魔方 西西 提交于 2019-12-05 08:50:34

问题


I would like to exclude libs directory from being lint'ed. However, ignores in options and planted .jshintignore file in project directory won't make libs to be excluded.

 jshint: {
  options: {
    smarttabs: true,
    ignores: ['public/js/libs/**/*.js']
  },

  all: [
        'Gruntfile.js', 
        'public/js/**/*.js'
      ]

},

grunt version:

 grunt-cli v0.1.11
 grunt v0.4.2
 grunt-contrib-jshint@0.7.2

What did I miss out?


回答1:


ignores is a jshint option and expects specific files. It's better to use the idiomatic Grunt negate ! to exclude files:

jshint: {
  options: {
    smarttabs: true
  },
  all: [
    'Gruntfile.js', 
    'public/js/**/*.js',
    '!public/js/libs/**/*.js'
  ],
},

See http://gruntjs.com/configuring-tasks#globbing-patterns



来源:https://stackoverflow.com/questions/20695823/grunt-contrib-jshint-ignores-has-no-effect

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!