jshint中文注释报错


【我是检测的Gruntfile.js文件,代码如下:】

module.exports = function(grunt){


 grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),
    contact: {
        options: {
            // 定义一个用于插入合并输出文件之间的字符
            separator: ';'
        },
        dist: {
            // 将要被合并的文件
            src: ['src/**/*.js'],
            dest: 'dist/<%= pkg.name %>.js'
        }
    },
    uglify: {
        options: {
            // 此处定义的banner注释将插入到输出文件的顶部
            banner: '/* <%= pkg.name %> <%= grunt.template.today("dd-mm-yyyy") %> */\n'
        },
        dist: {
            files: {
                'dist/<%= pkg.name %>.min.js': ['<%= concat.dist.dest %>']
            }
        }
    },
    qunit: {
        files: ['test/**/*.html']
    },
    jshint: {
        // define the files to lint
        files: ['Gruntfile.js', 'src/**/*.js', 'test/**/*.js'],
        // configure JSHint (documented at http://www.jshint.com/docs)
        options: {
            // more options here if you want to override JSHint defaults
            globals: {
                jQuery: true,
                console: true,
                module: true,
                document: true
            }
        }
    },
    watch: {
        files: ['<%= jshint.files %>'],
        tasks: ['jshint', 'qunit']
    }
});

grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-qunit');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-concat');

// 在命令杭商输入"grunt test", test task就会被执行
grunt.registerTask('test', ['jshint', 'qunit']);

// 只需在命令行上输入"grunt", 就会执行default task就会被执行
grunt.registerTask('default', ['jshint', 'qunit', 'concat', 'uglify']);

};

【报错如下:】
F:\test_nodejs\grunt\test>jshint Gruntfile.js
Gruntfile.js: line 7, col 19, This character may get silently deleted by one or more browsers.
Gruntfile.js: line 11, col 19, This character may get silently deleted by one or more browsers.
Gruntfile.js: line 18, col 19, This character may get silently deleted by one or more browsers.
Gruntfile.js: line 56, col 7, This character may get silently deleted by one or more browsers.
Gruntfile.js: line 59, col 8, This character may get silently deleted by one or more browsers.

5 errors

【环境:】
windows7 64bit
nodejs v0.10.35
grunt-cli v0.1.13
grunt v0.4.5
jshint v2.6.3
编辑器: sublime text3 build 3065
文件编码格式:无BOM utf-8

grunt jshint

fyyoj 10 years, 1 month ago

我这里没有检测到任何问题。

Arch Linux
nodejs 0.12.0-4
nodejs-jshint 2.6.0-1

一等星的光辉 answered 10 years, 1 month ago

Your Answer