How to use the jshint/src/cli.run function in jshint

To help you get started, we’ve selected a few jshint examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github FGRibreau / check-build / src / interface / jshint.js View on Github external
options.args = grunt.file.expand(options.args);

    options.reporter = function (results, data, options) {
      // @todo implement fixmyfs
      // if (checkBuildOptions.checkbuild.enable.indexOf('fixmyjs') !== -1) {
      //   results.forEach(function (file) {
      //     console.log(fixmyjs.fix(shjs.cat(file.file), {}));
      //   });
      // }

      // use jshint-stylish by default
      var stylish = require('jshint-stylish').reporter(results, data, options);
      return stylish;
    };

    var hadErrors = !jshintcli.run(options);
    f(hadErrors);
  };
};
github gruntjs / grunt-contrib-jshint / tasks / lib / jshint.js View on Github external
// Run JSHint on all file and collect results/data
    var allResults = [];
    var allData = [];
    cliOptions.args = files;
    cliOptions.reporter = function(results, data) {
      if (reporterOutputDir) {
        results.forEach(function(datum) {
          datum.file = path.relative(reporterOutputDir, datum.file);
        });
      }
      reporter(results, data, options);
      allResults = allResults.concat(results);
      allData = allData.concat(data);
    };
    jshintcli.run(cliOptions);
    done(allResults, allData);
  };
github yeoman / generator-gruntplugin / test / test-creation.js View on Github external
glob('**/*.js', function (err, files) {
      options.args = files;
      var valid = jshint(options);
      assert.ok(valid);
    });
  });
github tschaub / gulp-newer / tasks.js View on Github external
exports.lint = function(done) {
  var args = ['index.js', 'tasks.js', 'spec.js'];
  var passed = jshint({args: args});
  process.nextTick(function() {
    done(passed ? null : new Error('JSHint failed'));
  });
};