Thursday, May 12, 2011

use jslint.com to check your javascript code quality (and prepare to get feeling hurt)

PHP developers may know that we can use php CodeSniffer (phpcs) to check php code quality. JSLint.com to javascript is exactly same as phpcs to php. The only issue is, you have to copy and paste your code through JSLint.com. Besides that, it is a pretty cool tool to help you find out your javascript coding issues. Try hard to ensure all your javascript code can pass through its test without any error. In my last blog, i said i need to find where my code causes the problem in IE and my IDE doesn't help me a lot, i use this jslint.com to find out finally.

Since you have to copy and paste your code to the website, it is better after we finish coding in one javascript file, we immediately check this file to ensure our code is in good coding quality. Otherwise, in a big javascript project, after you already created a lot of javascript files, and then come back to check them one by one, that is gonna be painful, and that is exactly what i've been feeling.


No comments: