Skip to content

Instantly share code, notes, and snippets.

@indexzero
Created October 4, 2011 23:59
Show Gist options
  • Save indexzero/1263204 to your computer and use it in GitHub Desktop.
Save indexzero/1263204 to your computer and use it in GitHub Desktop.
JUST SAY NO TO COMMA FIRST
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');
}
}
});
@TooTallNate
Copy link

lol why?

@goatslacker
Copy link

LOL

@indexzero
Copy link
Author

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.

@goatslacker
Copy link

@indexzero
Copy link
Author

@goatslacker
Copy link

Poops, beat me to it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment