Automatically find trailing commas in your javascript project

These are simply updated instructions based upon the original Amaxus writeup here.

  • Install Rhino  (I used "port install rhino")
  • Grab the Rhinoized JSLint script here.
  • Create a script named checkForJsErrors.sh with the following two lines:

echo $1
rhino rhinoed_jslint.js $1 | fgrep -e 'Unexpected' --color=always 

  • Create an alias in your bashrc

alias checkjs='find . -name '''*.js''' -exec ~/bin/checkForJsErrors.sh {} ;'

Now when you execuate that alias in your project's root directory - all of your .js files will be scanned for trailing commas.

You're welcome.

 

Share Comments