需要示例gruntfile.js,它定义了jshint的报告器

1 configuration jshint gruntjs

我想在grunt设置中使用jshint的自定义报告器.目前我没有时间成为node.js/grunt专家,所以我希望找到一个样本grunt文件,其中包含一个记者的定义以及如何将其提供给jshint.

广泛的搜索只给了我一些样本gruntfile.js,其中没有一个改变了jshint的报告者.我查看了所有提到"gruntfile.js"的堆栈溢出帖子的摘要.

谢谢

Rom*_*nko 5

你需要这个:

  options: {
    reporter: 'jslint'
  }
Run Code Online (Sandbox Code Playgroud)

这是我的Gruntfile.js(原始):

/* jshint strict: true, devel: true  */
require('./config.js');

module.exports = function(grunt) {
  'use strict';

  grunt.initConfig({
    jshint: {
      all: ['Gruntfile.js', 'config.js', 'src/**/*.js'],
      options: {
        reporter: 'jslint'
      }
    }
  });

  grunt.loadNpmTasks('grunt-contrib-jshint');

  grunt.registerTask('foo', function() {
    requirejs('resources').copy();
  });

  grunt.registerTask('default', ['jshint', 'foo']);
};
Run Code Online (Sandbox Code Playgroud)