Skip to content

Instantly share code, notes, and snippets.

@rwaldron
Forked from indexzero/no-comma-first.js
Created October 5, 2011 13:49
Show Gist options
  • Save rwaldron/1264468 to your computer and use it in GitHub Desktop.
Save rwaldron/1264468 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');
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment