Beispiel #1
0
 this.hintJS = function(file, options){
   var opts = attutil.merge(this.options.js, options);
   var r = jshint.hint([file], opts);
   if(!r.length){
     console.log('\nok %s\n'.yellow, file);
   }
 }
Beispiel #2
0
  grunt.registerHelper('checkstyle', function(src, options, globals) {
    // JSHint sometimes modifies objects you pass in, so clone them.
    options = grunt.utils._.clone(options);
    globals = grunt.utils._.clone(globals);
    // Enable/disable debugging if option explicitly set.
    if (grunt.option('debug') !== undefined) {
      options.devel = options.debug = grunt.option('debug');
      // Tweak a few things.
      if (grunt.option('debug')) {
        options.maxerr = Infinity;
      }
    }
    var msg = 'Generating checkstyle report ...';
    grunt.verbose.write(msg);
    // Lint.
    opts = options || {};
    opts.globals = globals || {};

    // get checkstyle reporter
    var reporter = require('../lib/checkstyle-reporter');

    hint.hint(src, opts || {}, reporter.reporter);

    return reporter.result;
  });
Beispiel #3
0
/**
 * Runs all JavaScript files located in the `code` directory through
 * the JavaScript Hint project (http://www.jshint.com).
 *
 * @param {Array}  code    A list of directories containing JavaScript files
 * @param {Object} options Options passed directly to the JSHint engine
 */
function lint ( code, options ) {
    if ( !options ) {
        options = {};
    }
    if ( !options.node ) {
        options.node = true;
    }
    hint.hint( code, options );
}