module.exports = function(input, map) { this.cacheable && this.cacheable(); var callback = this.async(); if (jshintcli.gather({ args: [this.resourcePath] }).length === 0) { return callback ? callback(null, input, map) : input; } if(!callback) { // load .jshintrc synchronously var config = loadRcConfig.call(this); jsHint.call(this, input, config); return input; } // load .jshintrc asynchronously loadRcConfig.call(this, function(err, config) { if(err) return callback(err); try { jsHint.call(this, input, config); } catch(e) { return callback(e); } callback(null, input, map); }.bind(this)); }
function end() { var files = jshintcli.gather({ args: [file] }); var isIgnored = files.length === 0; if (!isIgnored) { var config = jshintcli.getConfig(file); delete config.dirname; if (!JSHINT(data, config, config.globals)) { this.emit('error', JSHINT.errors.map(formatError).join('\n')); } } this.queue(data); this.queue(null); }
exports.process = function (source, options/*, reportInfo */) { if (options == null || Object.getOwnPropertyNames(options).length === 0) { options = { options : {}, globals : {}}; var jsHintOptions = jsHintCli.getConfig(source); if (jsHintOptions != null && Object.getOwnPropertyNames(jsHintOptions).length > 0) { if (jsHintOptions.globals) { options.globals = jsHintOptions.globals; delete jsHintOptions.globals; } options.options = jsHintOptions; } } var results = lint(source, options.options, options.globals); var report = generateReport(results); return report; };