当运行此Gulp任务时
var gulp = require('gulp'),
util = require('gulp-util'), // For logging
print = require('gulp-print'), // For logging
jshint = require('gulp-jshint');
gulp.task('analyse', function () {
log('Analyzing source with JSHint')
gulp.src(paths.jsContent)
.pipe(print())
.pipe(jshint())
.pipe(jshint.reporter('jshint-stylish', { verbose: true }))
.pipe(jshint.reporter('fail'));
});我得到了这个输出:
14:43:26开始“分析”. 14:43:26用JSHint分析源 14:43:26在32 ms后完成“分析” 吞咽Scripts\main.js 错误:无法解析配置文件: C:\MyProject\src\MyProject.jshintrc 错误:SyntaxError:意外令牌
我使用的Gulp文件来自https://raw.githubusercontent.com/johnpapa/pluralsight-gulp/master/.jshintrc,如下所示:
{
"bitwise": true,
"camelcase": true,
"curly": true,
"eqeqeq": true,
"es3": false,
"forin": true,
"freeze": true,
"immed": true,
"indent": 4,
"latedef": "nofunc",
"newcap": true,
"noarg": true,
"noempty": true,
"nonbsp": true,
"nonew": true,
"plusplus": false,
"quotmark": "single",
"undef": true,
"unused": false,
"strict": false,
"maxparams": 10,
"maxdepth": 5,
"maxstatements": 40,
"maxcomplexity": 8,
"maxlen": 120,
"asi": false,
"boss": false,
"debug": false,
"eqnull": true,
"esnext": false,
"evil": false,
"expr": false,
"funcscope": false,
"globalstrict": false,
"iterator": false,
"lastsemic": false,
"laxbreak": false,
"laxcomma": false,
"loopfunc": true,
"maxerr": 50,
"moz": false,
"multistr": false,
"notypeof": false,
"proto": false,
"scripturl": false,
"shadow": false,
"sub": true,
"supernew": false,
"validthis": false,
"noyield": false,
"browser": true,
"node": true,
"globals": {
"angular": false
}
}这个问题能解决吗?
发布于 2015-09-24 15:03:58
只要用约翰回购的原始文件替换你的.jshintrc文件,你就会没事的。
https://stackoverflow.com/questions/31637128
复制相似问题