Created
September 22, 2012 16:02
-
-
Save nfriedly/3766618 to your computer and use it in GitHub Desktop.
JSHint ignores the `indent:` option hwen it's passed in globally
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// contrived example. This file uses 3 spaces for indentation | |
function doStuff() { | |
console.log("Stuff!"); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env node | |
var fs = require('fs'), | |
util = require('util'); | |
var jshint = require('jshint').JSHINT; | |
var src = fs.readFileSync('./testcode.js').toString(); | |
var success = jshint(src, {indent: 4}); | |
if (success) { | |
util.puts("The file passed"); | |
} else { | |
util.puts("The file failed JSHint with the following errors:"); | |
jshint.errors.forEach(function(err){ | |
if (err) { // sometimes there's a null at the end of the errors list | |
util.error(util.format("\n%s\n%s\nline:%d, character:%d", err.reason, (err.evidence || '').trim(), err.line, err.character)) | |
} | |
}); | |
} | |
// expected behavior is an error about onluy using 3 spaces to indent | |
// actual behavior is that the scripts outputs "The file passed" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment