JavaScript is a language of Web. This series of articles will talk about my observations learned during my decade of software development experience with
JavaScript. I hope this series on JavaScript is giving you a good understanding and you are enjoying most parts of it.
This is a continuation of the last article on JSLint, we will start with Options and command-line utility of JSLint. Connect the dots where we left now, but read the last article (link) before reading this one otherwise you will feel nausea, drowsiness, and feel unhappy.
Go to URL:
http://www.jslint.com/
You can fiddle with JSLint and customize your warnings via Options below:
I am going to show commonly used options here:
Function report
It displays an output showing about global objects and objects leveraged inside our function.
What is the biggest problem in JavaScript?
Answer: I am going to share my opinion that it is not possible to determine at compile time if you misspell the name of variables. The risk is it will create global undefined variables. As an outcome, developers will spend a lot of time troubleshooting and debugging code. If front-end code grows exponentially then code smells in absence of right design and best practices.
FYI: Another advantage of JSLint is that it can read JSON also.
Command-line support
As developers, we love command prompt. The good news is JSLint is available as a node module and we will learn how to lint our JS files locally.
Assumption: I believe you have NodeJS installed, if not please refer to my
article number 6 of this series. We will first install the jslintJSLint npm package in the existing NodeJS repository.
Steps
Summary
I believe now you have a good understanding of the linting &JSlintJSLint tool. There are many other tools available in JavaScript like JShintJoshing, ESlintSlant. Some of these were forked from JSlintJSLintgithubGitHub repository and based on JSlintJSLint fundamentals but differ in some contexts.