How to use the jshint/lib/hint.js.hint 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 colorhook / att / plugins / cdn.js View on Github external
AttUtil.doSequenceTasks(files, function (file, callback) {
			var extname = path.extname(file).replace(/\./, "").toLowerCase();

			//检查 js, css syntax
			if(check === 'true' || (check !== 'false' && extname == "js" && checkJS)){
				var results = jshint.hint([file]);
				var len = results.length,
					str = '',
					file, error;

				results.forEach(function (result) {
					file = result.file;
					error = result.error;
					str += file  + ': line ' + error.line + ', col ' +
						error.character + ', ' + error.reason + '\n';
				});

				if (str) {
					console.log(str + "\n" + len + ' error' + ((len === 1) ? '' : 's') + "\n");
				}else{
					console.log("jshint Perfect: %s", file);
				}
github colorhook / att / plugins / jshint.js View on Github external
glob(query, function (err, matches) {
		matches.forEach(function(item){
			var stat = fs.statSync(item);
			if(stat.isFile() && item.match(/\.js$/i)){
				files.push(item);
			}
		});

		if(files.length == 0){
			return console.log("no js file matched");
		}
			
        if (jshint.hint(files).length === 0) {
            console.log("Perfect!");
        }
    });
};