Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Commits on Oct 12, 2012
  1. @valueof

    Updated with a deprecation notice.

    valueof authored
    All cool stuff is happening at jshint/jshint now.
Commits on Aug 19, 2012
  1. @WolfgangKluge
Commits on Aug 15, 2012
  1. @valueof

    Add Travis CI configuration file.

    valueof authored
    Just to be clear, I hate the fact that I can't set these
    simple options somewhere on Travis CI website. I _really_ don't
    like introducing service specific configuration files into
    my repos.
    But whatever, it adds some value.
  2. @valueof

    Updated README with more information and useful links.

    valueof authored
    Not everyone looks into our wiki so some useful documents don't
    get enough attention. This patch adds links to those documents
    to the README. It also adds a manual for contributors.
  3. @WolfgangKluge @valueof

    Add coverage task to Grunt file.

    WolfgangKluge authored valueof committed
    This patch adds a new task--cover--that runs all unit tests to collect
    coverage data. Use `grunt cover` to see the report or `grunt cover
    --server` to run the coveraje web server.
    Closes GH-14.
    Squashed commit of the following:
    commit f007515334b251fcc2e40864d5a061d27fadfa13
    Author: Anton Kovalyov <>
    Date:   Wed Aug 15 12:55:54 2012 -0700
        Fix path
    commit 2056626
    Author: Wolfgang Kluge <>
    Date:   Tue Aug 14 22:14:55 2012 +0200
        Fix path to jshint.js
    commit 834225d
    Author: Wolfgang Kluge <>
    Date:   Sun Aug 12 12:22:38 2012 +0200
        Add coverage task to gruntfile
        The task runs all unit tests to collect coverage data. Use `grunt cover`
        to see the report or `grunt cover --server` to run the coveraje web server.
Commits on Aug 13, 2012
  1. @valueof

    Parse JSHint options from comments.

    valueof authored
    This patch makes JSHint to parse comments and store all the options
    defined within them. Options now have new syntax and new placement
    	* Options can be defined as block comments as well as one-line
    	* Options comments must come before any other code in the scope.
    	* New syntax: 'jshint:[set|ignore] [comma separated values].
    	// jshint:set var
    	function main(cb) {
    		// jshint:ignore W001
    		"use strict";
    		cb(function () {
    			var a = 1;
    			// jshint:set strict
    			return a;
    The code above sets one global option, var, and ignores all W001
    warnings within the function main. Comment on line 9 is ignored
    because it comes after the start of the function body.
    	GH-16: Ability to set options
  2. @valueof

    Switch to the bleeding edge version of Esprima.

    valueof authored
    We need a few Esprima features that are not in the stable version
    yet so I've decided to use -dev version until Esprima 1.0 arrives.
    Esprima changed how its output data a bit so I need to update some
    code to make sure all tests pass (they do now). But this means
    that JSHint Next is not compatible with current stable version of
    Esprima anymore.
Commits on Aug 11, 2012
  1. @valueof

    Use Peakle for walkable lists.

    valueof authored
    Since I added another walkable list to our code, Comments, I thought
    about abstracting the whole peak/next/prev interface to prevent code
    duplication. This patch adds a new dependency: a tiny abstraction
    over lists called Peakle.
    More info:
  2. @valueof

    Warn about missing semicolons before +, - and /

    valueof authored
    So I just realized that, in addition to ( and [, operators +, - and
    / are also problematic when it comes to automatic semicolon insertion.
    That's because code like this:
    	var a = b
    Will be parsed like this:
    	var a = b + c;
    So I added more checks to make sure we catch those kind of errors.
    Unfortunately it can generate a false positive with code like this
    (but we can fix that later by walking up the tree or something):
    	var a
    (This patch was written at 10k feet on my way to Boston)
Commits on Aug 9, 2012
  1. @WolfgangKluge @valueof

    Fix helper to pass all tests on windows

    WolfgangKluge authored valueof committed
    If the git option `autocrlf` is on, the files are stored with CRLF
    (even if LFs are stored in the repository) and committed with LF.
    Thus the absolute character positions aren't equal to the linux version.
    Also fixes a problem getting the filename on windows (/ vs. \)
  2. @xjamundx @valueof

    Warn when extending built-ins.

    xjamundx authored valueof committed
    Most people agree it's not a great idea to extend built-in objects.
    With this option we will warn when built-in objects are extended in
    the following ways:
    	Object.prototype = {}; = function () {};
    There are several other ways that devs can extend natives that are
    not covered, but this seems like it covers the majority of cases.
    This currently relies on the list in constants.js labeled
    `ecmaIdentifiers` which is imperfect but probably works well enough.
Commits on Jul 19, 2012
  1. @valueof

    Warn about unescaped dashes in regular expressions.

    valueof authored
    Ported regexdash option from stable repo. The code is a bit hard to
    comprehend so I will need to write comments later.
  2. @valueof

    Replace Events library with EventEmitter.

    valueof authored
    There is no need to include a library we extracted from Backbone
    if Node has a perfectly fine built-in helper called EventEmitter.
    Well, perfectly fine is a bit of a stretch because it doesn't
    support space separated events:
      linter.on("IfStatetement ForStatement", function () { ... });
    So when I was swaping helpers I had to write wrapper functions for
    the Linter object: on and trigger that act as their counterparts in
    I also used composition instead of inheritance.
  3. @valueof

    Add new module: regexp.

    valueof authored
    So far it is pretty primitive--I reimplemented option 'regexp' but
    hopefully in future it will be able to catch more subtle regular
    expression oddities.
    Also Esprima blows up on invalid regular expression so we don't need
    to parse/verify it ourselves. However, this means that we really have
    to make Esprima more tolerant.
Commits on Jun 23, 2012
  1. @valueof

    Optimize slow Tokens.find

    valueof authored
    I profiled JSHint on Underscore source code and noticed that
    Tokens.find and Tokens.getRange were slow because I was looping
    through all tokens for each lookup.
  2. @valueof

    Stop processing after 50 messages.

    valueof authored
    JSHint tends to hang on bigger files. Until this is resolved we need
    a hard cap on messages.
Commits on Jun 21, 2012
  1. @valueof

    Add main, scripts.test and scripts.lint to package.json.

    valueof authored
    NPM provides lots of goodies for package maintainers and we should
    use them. @domenic suggested to start with main, test and lint so
    that project contributors could use 'npm test', 'npm run-script lint'
    and require('jshint') without caring about underlying build tools
    we use. This also allows them to run our build tools without globally
    installing them.
    Related ticket: GH-4.
  2. @valueof

    Improve safe() function to handle all default Object properties.

    valueof authored
    Jamund (gh:xjamnundx) found out that ScopeStack.addUse method fails
    on variables such as toString, etc. This happens because we're to
    add a new property with a name that is similar to one already in
    a prototype chain for this object. We had this problem with __proto__
    before and that's why we have function safe() that handles this
    particular case.
    This patch improves safe() to handle all default Object properties.
    Issues: GH-6
Commits on Jun 18, 2012
  1. @valueof

    Add a grunt task to browserify JSHint

    valueof authored
    Since I'm writing JSHint Next as a node program we need a way to
    run it in (modern) browsers. Browserify to the rescue!
  2. @valueof

    Remove human friendly labels from warnings and errors.

    valueof authored
    Human friendly labels (e.g. DunderProto) were used for development
    only. I initially thought that it'd be easier to write and memorize
    them as opposed to dry DNNN codes.
    But making up short enough labels for them is extremely annoying.
    So I decided to drop them all together.
    P.S. I don't know what would I do without tests. Architecture
    refactoring (this and previous commits) are impossible without tests.
  3. @valueof

    Major refactoring: JSHint is now event-based and modular.

    valueof authored
    Refactored JSHint to make it modular and event-based. This means that
    you can now plug in your own linter:
    	var linter = new Linter(code);
    Inside your linter you can subscribe to events that are broadcasted on
    every parsing step:
    	function myLinterFunc(linter) {
    		linter.on("DebuggerStatement", function (expr) {
    			console.log("Don't debug me bro");
Commits on Jun 17, 2012
  1. @valueof

    New Linter class for more flexible usage.

    valueof authored
    We need to go away from old JSHINT() function. This patch introduces a
    new class Linter that is used by old JSHINT() function.
  2. @valueof

    Warn when assignments are used instead of conditionals.

    valueof authored
    This patch lands a feature that warns when an assignment could be
    a typo. For example:
    	if (a = 1) {}
    	for (var a = 0; a = 10; a++) {}
    Do we _really_ need to assign in the examples above? Or was
    that a finger slip and author meant to use == instead?
  3. @valueof

    Refactored the use of constants.

    valueof authored
    I got tired of writing constants.warnings.ConstLabel all the time
    and I realized that I used addError instead of addWarning so this
    patch fixes both problems.
  4. @valueof

    Move* helpers into a Token class.

    valueof authored
    Simple refactoring in order to make code a bit cleaner. Cause writing
    utils.isPunctuator(token, ".") instead of token.isPunctuator(".")
    is stupid.
  5. @valueof

    Return an error instead of a warning on undefined vars in strict mode.

    valueof authored
    Since strict mode throws runtime errors when accessing undefined
    variables, JSHint needs to display an error--and not a warning--when
    it encounters similar patterns.
  6. @valueof

    Warn about arguments.callee and arguments.caller

    valueof authored
    This patch implements warnings for arguments.callee and arguments.caller
    properties since they make certain VM optimizations pretty difficult.
    Both dot notation and brackets notations are supported.
    And in strict mode arguments.callee is prohibited so we need to error
    if we encounter one.
    This patch also contains a change that makes ScopeStack strict mode
Commits on Jun 13, 2012
  1. @valueof

    Spot undefined variables and warn about them.

    valueof authored
    This is one of the most important features of JSHint. It finds
    variables that were used but never defined and warns about them
    helping developers to find and elinimate global scope leaks.
    It also knows about edgecases such as typeof and delete.
Commits on Jun 12, 2012
  1. @valueof

    New helper function for tests: .addErrors

    valueof authored
    Writing .addError 10 times for a single error is pretty boring
    so I wrote another helper that allows you test for some particular
    error on multiple lines at once. Just a shortcut.
  2. @valueof

    Add support for predefined global variables.

    valueof authored
    We need to provide JSHint a list of predefined global variables in
    some tests to make sure we don't have to track tons of unrelated
    warnings and exceptions. This patch adds such support via special
    parameter to reason.parse().
    Inline flags (/* global ... */) will be implemented later.
Commits on Jun 7, 2012
  1. @valueof

    New Tokens class for easier tokens traversal

    valueof authored
    It is a real pain in the ass to manually calculate indexes and
    always keep local variables referencing previous, next and current
    tokens. This patch adds a new object, Tokens, that is essentially
    a wrapper around an array of tokens with little helper functions
    such as peak(), next(), prev(), etc.
Commits on Jun 6, 2012
  1. @valueof

    Add TODO file to the .gitignore

    valueof authored
    I like to keep my immediate TODO in the same repo but I don't want
    to commit it. That's why adding it to the .gitignore.
Commits on May 31, 2012
  1. @valueof

    Fix a small styling issue.

    valueof authored
    We try to use white:true whenever possible for consistency so this
    patch just adds a space to keep JSHint happy.
  2. @valueof

    Warn about shadowed variables.

    valueof authored
    Shadow variables can lead to some really hard to find bugs--this patch
    makes JSHint Next warn about all found instances. For example:
    	var face = "...";
    	// Hundreds of lines of code.
    	function CleverFunction(face) { // JSHint warning
    		// ...
  3. @valueof

    Add support for scope-aware variable stacks

    valueof authored
    JSHint is very useful at spotting accidentally shadowed or mistyped
    variables. To port that functionality to Next we need to have a
    scope-aware variable stacks: so that at any time we can easily check
    if a variable has already been defined and is accesible from within
    the current scope.
    This patchs adds ScopeStack object to maintain such stacks.
Something went wrong with that request. Please try again.