【问题标题】:Gulp cannot parse .hintrc fileGulp 无法解析 .hintrc 文件
【发布时间】:2015-07-26 12:48:23
【问题描述】:

当运行这个 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 毫秒后完成“分析”
[gulp] 脚本\main.js
错误:无法解析配置文件:C:\MyProject\src\MyProject.jshintrc
错误:语法错误:意外的标记

我使用的 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
    }
}

这可以解决吗?

【问题讨论】:

    标签: gulp jshint


    【解决方案1】:

    只需将您的 .jshintrc 文件替换为 John 存储库中的原始文件即可。

    【讨论】:

    • 谢谢。能否提供原文链接?
    猜你喜欢
    • 2018-01-25
    • 1970-01-01
    • 2021-12-27
    • 1970-01-01
    • 2014-03-05
    • 2021-10-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多