Cleaner code is always critical. When you are staring at an empty text file, using online tools such as jslint.com and jshint.com is pretty easy. But when your code grows to hundreds or even thousands of lines, constantly copy/pasting the entire contents of your JS file into these tools gets tedious. Some text-editors have great plugins that incorporate linting into your development environment, that that is often a great way to go.
But what if you simply want to do a quick “dummy-check” ?
I just stumbled across jscritic.com by Juriy Zaytsev and found it to be quite helpful for just that purpose.
The sub-title of this tool is: “Quickly check how well 3rd party script behaves.” That promise is kept by the following features:
- Does it browser sniff?
- Does it extend native objects?
- Does it use document.write?
- Does it use eval?
- Does it use ES6 features?
- Does it use Mozilla-only features?
- Does it have IE incompatibilities?
But it is was these tools that really impressed me:
- How many global variables?
- How many unused variables?
- Total size KB
- Minified size
The first time I visited JSCritic.com, I quickly dumped the script I was working on into it and found out that I had a few un-intended implied globals and plenty of unused variables. The total “Total size KB” and “Minified size” are also helpful in terms of getting a quick idea of your script’s overall footprint. A quick look at Juriy Zaytsev’s blog and you can see he’s a serious JavaScript developer. I’m looking forward to reading his articles. In the meantime, I’m making good use of his tool: JSCritic.com.