What is JavaScript linting?

Before we talk about JSLint, we need to discuss linters in general, what they are, and how they influence JavaScript performance. A lint is, simply put, a code-validation checker. It allows a developer to point to a code file and check for errors or potential issues ranging from spacing issues to pure code errors.

Linters typically receive the contents of a file and build a source tree. In the case of JavaScript, this can be objects such as global variables, functions, prototypes, arrays, and so forth. After the tree is created, analyzers will take parts of the source tree and report anything an analyzer that was written would flag. Lastly, any rule readers or parameters flagged before running the linter will look for ...

Get Mastering JavaScript High Performance now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.