0

咕噜文件

module.exports = function(grunt) {

    // Project configuration.
    grunt.initConfig({
        // This line makes your node configurations available for use
        pkg: grunt.file.readJSON('package.json'),
        banner:
            '/*! <%= pkg.title || pkg.name %> - v<%= pkg.version %> - <%= grunt.template.today("yyyy-mm-dd") %>\n' +
            '<%= pkg.homepage ? " * " + pkg.homepage + "\\n" : "" %>' +
            ' * Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author %>;\n' +
            ' * Licensed <%= _.pluck(pkg.licenses, "type").join(", ") %>\n */\n',
        src: {
            js: ['src/**/*.js']
        },
        // This is where we configure JSHint
        jshint: {
           myFiles: ['gruntFile.js', '<%= src.js %>'],
           options:{
                newcap:true,
                globals:{}
           } 
        }
    });
    // Each plugin must be loaded following this pattern
    grunt.loadNpmTasks('grunt-contrib-jshint');
    grunt.registerTask('default', ['jshint']);

};

为什么当我运行 grunt 我仍然有

调用构造函数时缺少“新”前缀。$scope.paginator = 分页器(2,5,medias);

Paginator 是一个角度服务/工厂/提供者

更新

它应该是:

options:{
    newcap:false,
    globals:{}
} 
4

1 回答 1

1

我不确定你的 jshint 配置对象。这是我在 npm 中使用 grunt-contrib-jshint https://www.npmjs.org/package/grunt-contrib-jshint的模式

    jshint: {
        options: {
            jshintrc: 'jshintrc'
        },
        main: {
            src: [
                'app/js/**/*.js',
                'test/unit/**/*.js'
            ]
        }
    },

也许用 grunt-contrib-jshint 包试一试

于 2014-03-14T22:20:14.410 回答