繁体   English   中英

使用现有的Grunt项目-获得JSHint缺少分号和错误

[英]Working with an existing Grunt project - Getting JSHint Missing semicolon and errors

在现有的GRUNT项目( http://gruntjs.com/getting-started )中,我先安装了npm,然后进行了grunt,并且得到了大量的JSHint错误(缺少分号,空格和制表符,多余的逗号等)。 我知道该项目正在不同的系统上工作。

错误说明:

Running "jshint:beforeconcat" (jshint) task
Linting js/filters/empFilter.js...ERROR
[L22:C4] Missing semicolon.
}]) 

带有错误的angularjs文件

angular.module ("app").filter('empFilter', [function () {
   return function (emps, username) {
      /*some code*/

      return emps;

   };
}])  /* <--- error at this line */

package.json

{
    "name": "test_app",
    "version": "0.0.11",
    "path": "http://127.0.0.1/TestApp/",
    "devDependencies": {
        "grunt": "~0.4.1",
        "grunt-autoprefixer": "~0.1.20130516",
        "grunt-contrib-concat": "~0.1.2",
        "grunt-contrib-uglify": "~0.1.1",
        "grunt-contrib-cssmin": "~0.4.0",
        "grunt-contrib-copy": "~0.4.0",
        "grunt-contrib-jshint": "~0.1.1",
        "grunt-contrib-yuidoc": "~0.4.0",
        "grunt-karma": "~0.4.4",
        "grunt-open": "~0.2.0",
        "grunt-bumpx": "~0.1.0",
        "autoprefixer": "~0.4.20130515",
        "grunt-git": "0.0.1",
        "grunt-devtools": "0.1.0-7"
    }
}

gruntFile.js中的JSHint选项

jshint: {
            options: {
                "globals": {
                    "asi": false, 
                    "ga": true,
                    "FileReader": true,
                    "html2canvas": true,
                    "console": true,
                    "angular": true,
                    "$": true,
                    "window": true,
                    "screen": true,
                    "Image": true,
                    "clearTimeout": true,
                    "setTimeout": true,
                    "document": true,
                    "localStorage": true,
                    "sessionStorage": true,
                    "device": true,
                    "navigator": true,
                    "io": true,
                    "createjs": true,
                    "lib": true,
                    "platform": true,
                    "inherits": true,
                    "signals": true,
                    "Date": true
                }
            }

我不想基于错误更新文件,因为该项目在另一个系统上工作正常。 我在这里想念什么吗?

可能另一个系统具有一个.jshintrc文件,该文件中包含宽松的.jshintrc选项,并且也许该文件未添加到源代码管理中。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM