JSHint/JSLint
Static code analysis for JavaScript
Lint
- Introduced for the C language
in later 70's - primitive compilers,
common mistakes - static code analysis needed
JSLint
Created by
Douglas Crockford
JavaScript: The Good Parts
“The JavaScript Code Quality Tool”
First release: 2002
De facto standard for
good quality JS code
But there are alternatives, too: Doctor JS, Closure Linter, JavaScriptLint
MIT license
in 12/11/2010 moved to GitHub…
…then a new story began
JSHint
Forked by Anton Kovalyov
at 19/01/2011, because
“[JSLint] is quickly transforming from a tool that helps developers to prevent bugs to a tool that makes sure you write your code like Douglas Crockford.”
“Warning! JSLint will hurt your feelings.”
versus JSHint:
“Our goal is to help JavaScript developers write complex programs without worrying about typos and language gotchas.”
JSLint “The JavaScript Code Quality Tool”, while JSHint is
„A JavaScript Code Quality Tool”
„The (Gentler) JavaScript Code Quality Tool”
„A Static Code Analysis Tool for JavaScript”
Contributors
JSLint: Douglas Crockford
(231 commits)
JSHint: 30+ including Wolfgang Kluge, Josh Perez, Douglas Crockford, Nicholas C. Zakas, Máté Farkas, etc., nearly 400 commits.
Enforcing options
|, &)=== and !==arguments.caller, arguments.callee++ and --.' in regular expressionsRelaxing Options
== null"use strict"__iterator__ property__proto__ property- in regular expressionsthis in a non-constructor function in strict modeEnvironments
console, alertLegacy
_' in variablesvar statementIntegration
Environments: Node.js, WSH, JavaScriptCore, Rhino
Editors: VIM, Emacs, Sublime Text 2, TextMate, Visual Studio, ShiftEdit, Komodo, Eclipse…
Easy to integrate with CI (Jenkins)
Lint or Hint?
JSLint: for generated code (CoffeeScript)
JSHint: for everything else
…or…
have the full control of the source code with a consistent coding style.