简体   繁体   中英

Need example gruntfile.js that defines a reporter for jshint

I would like to use a custom reporter for jshint in a grunt setting. At the moment I don't have time to become a node.js/grunt expert, so I had hoped to find a sample grunt file that includes a definition of a reporter and how to supply it to jshint.

Extensive searching has given me only a few sample gruntfile.js, none of which change the reporter for jshint. I looked at the summaries all of the stack overflow posts that mention "gruntfile.js".

Thanks

You need this:

  options: {
    reporter: 'jslint'
  }

Here is mine Gruntfile.js (raw):

/* 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']);
};

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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