Created
October 4, 2011 23:59
-
-
Save indexzero/1263204 to your computer and use it in GitHub Desktop.
JUST SAY NO TO COMMA FIRST
This file contains hidden or 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
var fs = require('fs'), | |
path = require('path'), | |
colors = require('colors'), | |
argv = require('optimist').argv; | |
fs.readFile(path.join(__dirname, argv._[0]), function (err, data) { | |
var lines = data.toString().split('\n'); | |
for (var i = 0; i < lines.length; i++) { | |
var match = lines[i].match(/\s+,/); | |
if (match) { | |
console.log('NO COMMA FIRST. FIX AT LINE: ' + i.toString().red); | |
console.log(lines[i] + '\n'); | |
} | |
} | |
}); |
LOL
Because I don't use comma-first and I need a tool to enforce this at Nodejitsu. I don't really care that much, but with a large code base you have to be consistent.
Poops, beat me to it.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
lol why?