我在项目中使用grunt-contrib-watch
已有好几个月了。但自上周以来它已经腐败了。
我用它来监视文件更改并启动jshint
或less
任务。一切正常。但今天grunt watch
忽略了我的.jshintrc
配置文件。所以它没有正确应用我的规则集。
如果我运行jshint
任务,则所有文件都会正确显示。从watch
运行相同的选项会被忽略...
我的配置如下所示:
jshint: {
options: {
jshintrc: '.jshintrc'
},
grunt: 'Gruntfile.js',
files : [ '**/*.js' ]
},
...
watch:{
jshint:{
files: '<%= jshint.files %>',
tasks: ['jshint:files']
}
}
为每个.js文件生成以下错误:
>> /Users/mybecks/Git/project/foobar/reuse.es.js
>> window is not defined
为什么它停止正常工作?
BR, mybecks
答案 0 :(得分:1)
在每个失败脚本的顶部添加注释:
/*global window */
详细了解这意味着什么:http://www.jslint.com/lint.html#global
不知道为什么早些时候没有出现......