from Wikipedia, the free encyclopedia

JSLint (from JS as an abbreviation for JavaScript and Lint ) is a tool for static source code analysis of JavaScript source code that was developed by Douglas Crockford . JSLint itself is written in JavaScript and is available as an online tool as well as on the command line.

Range of functions

JSLint examines JavaScript source code and returns explanatory messages about problematic areas and their approximate location in the source code. On the one hand, real syntax errors and, on the other hand, stylistic weaknesses and structural problems that can be programming errors or can easily lead to them are shown. JSLint cannot guarantee that the software will run correctly, but it does make problem analysis easier. The scope of the check can be configured, either via the interface or through special source text comments . Some of the problems that JSLint is pointing out include:

  • Global variables : JSLint expected that all variables are local and before first use declared to be. Exceptions can be configured via options so that JSLint accepts, for example, the global variables that are available in web browsers , so window, documentetc. This makes typing errors in variable names easier to spot.
  • JSLint expects that only blocks are used within control structures, even if they only contain a single statement . If the programmer does not use blocks, it can easily happen when the source code is expanded that the structure of control structures is accidentally destroyed.
  • All statements must end with a semicolon, long lines may only be broken after an operator. This prevents errors that can occur when the automatic semicolon insertion works unexpectedly .
  • Assignments in places where a comparison is more likely to be expected (in the case of loops and conditional statements ) are recognized as errors.
  • JSLint forbids "slipping through" in case statements , which can also easily lead to errors.


JSLint is under its own license, the JSLint license . This license is similar to licenses for free software , but contains a restriction that prohibits use for “evil” purposes. JSLint is therefore classified as unfree by the FSF and Debian .


With JSHint there is a spin-off , which allows less stringent than be tested by Crockfords personal style. ESLint was developed as a free alternative without restrictions.


  • Douglas Crockford: The best thing about JavaScript. O'Reilly-Verlag, 2008. ISBN 978-3-89721-876-5 . Appendix C: JSLint.

Web links

Individual evidence

  1. Sources from JSLint including license
  2. Comment on the equivalent wording for the JSON license
  3. ^ Anton Kovalyov: Why I forked JSLint to JSHint. Published February 20, 2011, accessed February 2, 2015.