Skip to content

Instantly share code, notes, and snippets.

@insin
Forked from indexzero/no-comma-first.js
Created October 5, 2011 00:15
Show Gist options
  • Save insin/1263228 to your computer and use it in GitHub Desktop.
Save insin/1263228 to your computer and use it in GitHub Desktop.
JUST SAY NO TO SEMICOLONS
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 SEMICOLONS. 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