Skip to content

Instantly share code, notes, and snippets.

@cybear
Created January 29, 2011 10:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cybear/801733 to your computer and use it in GitHub Desktop.
Save cybear/801733 to your computer and use it in GitHub Desktop.
A textmate command for JSLint
#!/usr/bin/env ruby
require 'cgi'
lint = `java -jar ~/Applications/jslint4java-1.4.6.jar "$TM_FILEPATH"`
lint.gsub!(/^jslint.*?((?:\/[\w\.\-]+)+).*?(\d+).*?(\d+).(.*)$/, '<p><label><a href="txmt://open?url=file://TM_FILEPATH&amp;line=\2">Line \2</a> \3</label>\4</p>')
lint.gsub!(/TM_FILEPATH/, ENV['TM_FILEPATH'])
print <<HTML
<!DOCTYPE html>
<html><head><style>
label{display:inline-block;width:85px;color:#666}
a{color:#000;text-decoration:none;font-weight:bold}
body{font-family:Arial}
h1{font-size:26px;font-family:Verdana;color:#666;font-weight:normal}
</style></head><body>
<h1>JS Lint</h1>
#{lint}
</body></html>
HTML
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment