Skip to content
Commits on Aug 20, 2012
  1. @valueof

    Add a shim for Array.prototype.indexOf

    valueof committed
    Apparently, whatever JavaScript engine WSH uses, it doesn't support
    Array.prototype.indexOf method so I had to add a shim for it. I took
    the original version from MDN and modified it to pass our lint tests.
    Closes GH-617.
Commits on Aug 19, 2012
  1. @valueof

    Don't generate false positives on /* inside comments.

    valueof committed
    JSHint used to attempt to detect nested multiline comments but
    that generated too many false positives:
         * To use bla.js provide path: bla("./*");
    In addition to that, nested multiline comments will error early
    no matter what so there is no need for JSHint to warn about them:
         * /* Nested comment */
    So I just removed that check.
    Closes GH-540
    Closes GH-599
Commits on Aug 17, 2012
  1. @valueof

    Add support for labeled and lonely blocks.

    Carl Ekerot committed with valueof
    This patch adds support for labeled and lonely blocks which
    are valid according to ECMA-262. The following cases are
    tested and supported:
            // Labeled block
            // Unlabeled block
    This fix also prevents the parser from halting when errors
    are present in statements after which a block is expected (e.g.
    For example, the following will report error, but not halt parsing
    with `Expected '(end)' and instead saw '}'.` which it did before,
    due to the first { not being taken in to account, and the
    bracket-matching would fail:
        if (a < b); {
            // Bad if-statement
    Closes GH-603.
    Squashed commit of the following:
    commit 2eb909c1e20f3e581b0cf520c6cf9ede5620adf8
    Merge: 38fe2c9 d211d34
    Author: Anton Kovalyov <>
    Date:   Thu Aug 16 21:32:42 2012 -0700
        Merge branch 'master' of git:// into CarlEkerot-master
    commit d211d34
    Merge: f5ea569 a1d7a7d
    Author: CarlEkerot <>
    Date:   Mon Aug 13 10:16:10 2012 +0200
        Merge remote branch 'upstream/master'
    commit f5ea569
    Author: CarlEkerot <>
    Date:   Thu Aug 2 08:41:44 2012 +0200
        Added assertions to ensure that code execution procedes after lonely blocks, and that start-bracket errors doesn't halt the parsing.
    commit 2d65d8a
    Merge: 8d4f985 03c8ee6
    Author: CarlEkerot <>
    Date:   Wed Aug 1 11:53:39 2012 +0200
        Merge branch 'master' of
    commit 8d4f985
    Author: CarlEkerot <>
    Date:   Wed Aug 1 11:13:21 2012 +0200
        Removed commented addError-calls in parser.js.
    commit e608f03
    Author: CarlEkerot <>
    Date:   Wed Aug 1 11:04:19 2012 +0200
        Fix for issue #565. Makes blocks a special case of statements. This fix also prevents jshint from crashing due to unmatched curly-brackets in many cases (such as 'expected {, was (end)' in tests/unit/fixtures/comma.js)
    commit 03c8ee6
    Author: Carl Ekerot <>
    Date:   Wed Aug 1 11:13:21 2012 +0200
        Removed commented addError-calls in parser.js.
    commit 7550336
    Author: Carl Ekerot <>
    Date:   Wed Aug 1 11:04:19 2012 +0200
        Fix for issue #565. Makes blocks a special case of statements. This fix also prevents jshint from crashing due to unmatched curly-brackets in many cases (such as 'expected {, was (end)' in tests/unit/fixtures/comma.js)
  2. @goatslacker @valueof

    Allow excluding globals

    goatslacker committed with valueof
    If I want to allow browser but I don't want anyone to use setInterval,
    for example, you should be allowed to do this.
    This allows the following syntax:
        /*jshint undef: true */
        /*global -event */
        event.hello(); // Warning
        JSHINT('event.hello()', {
            browser: true,
            predefs: ['-event']
        }) === false;
        Closes GH-566
        Closes GH-562
    Squashed commit of the following:
    commit db51992aff1023a760d691d299214d9c711eb3ad
    Merge: 21ba612 ca001d8
    Author: Anton Kovalyov <>
    Date:   Thu Aug 16 21:01:42 2012 -0700
        Merge branch 'gh-562-3' of git:// into goatslacker-gh-562-3
    commit ca001d8
    Author: Josh Perez <>
    Date:   Tue Jun 26 20:14:58 2012 -0700
        Adds exclusion syntax to predefs in options
    commit 0041ccb
    Author: Josh Perez <>
    Date:   Tue Jun 26 20:08:51 2012 -0700
        Adds exclude function to global directive
Commits on Aug 16, 2012
  1. @valueof

    Don't enable newcap for strict mode if it was explicitly disabled.

    valueof committed
    JSHint turns on 'newcap' for strict mode because there accessing
    unbound 'this' throws an error. However, if someone explicitly
    turned off 'newcap' we shouldn't force it back. Just assume that
    the person tweaking these option knows better.
    Closes GH-438.
  2. @valueof

    Add support for parens outside of IIFE.

    valueof committed
    This patch simply removes a nitpicking warning about whether one
    should put parens on the inside of IIFE or the outside.
    Closes GH-470
  3. @valueof

    Make 'unused' check smarter about unused arguments.

    valueof committed
    This patch modifies 'unused' checks so that they ignore arguments
    that were never used but that were followed by used arguments. For
        function one(a, b) {
            return b;
    In this example, since unused 'a' is followed by used 'b', JSHint
    assumes that this is a backwards compatibility issue or a specific
    API pattern and suppresses the warning.
    But this example, on the other hand, will generate a warning for 'b'
    because there is no reason to keep it around:
        function one(a, b) {
            return a;
        Closes GH-607
  4. @valueof

    Make be consistent with option.unused

    valueof committed is a legacy array that were kind of broken.
    Lots of warnings were pointing to the parent function and generated
    lots of false positives.
    This patch makes option.unused to populate that array meaning
    that JSHINT.errors and will have the same data
    when it comes to unused variables.
    This patch removes one property from so
    scripts may break.
    Fixes GH-610.
  5. @valueof

    Set default value for 'lines' on each run.

    valueof committed
    JSHint has a lot of state variables that are shared between runs.
    We need to re-assign default values to some of them on each run
    so that they don't screw up anything.
    One particular bug (GH-615) happened because 'warning' needed
    a variable named 'lines' that was not defined yet. Tests didn't
    catch that bug because there 'lines' was defined in previous
    test cases (no isolation in our testing framework whatsoever).
    Fixes GH-615.
Commits on Aug 13, 2012
  1. @valueof

    Merge pull request #608 from goatslacker/char

    valueof committed
    Fix character positions.
    This patch fixes character positions reported by JSHint
    in its warnings. Useful for fixmyjs and other programs
    that rely on such data.
Commits on Aug 8, 2012
  1. @valueof

    Remove mention of

    valueof committed
    We removed in f74fc32
    but forgot to kill it from the docs.
  2. @valueof

    Merge pull request #609 from amire80/master

    valueof committed
    It makes sense to have our license in the README as well as in the main file.
Commits on Aug 7, 2012
  1. @amire80

    Add the license to README

    amire80 committed
    The license for this software was hidden in the comment of the JS
    file. It should be easier to find, so I put it in the README.
  2. @goatslacker
  3. @goatslacker
  4. @goatslacker
  5. @goatslacker
Commits on Aug 5, 2012
  1. @valueof
  2. @valueof

    Fix how Rhino wrapper treats predefined args.

    valueof committed
    This patch fixes how Rhino wrapper treats predefined args. You don't
    need to include '=' anymore and default override value is now false.
    Here's wrapper's new signature:
    jshint-rhino.js [filename,..] [option=true,..] [global=true,global,..]
     * options must follow filenames
     * options must have '=' in them
     * predefs must follow options
    Closes GH-569.
  3. @valueof

    Make 'unused' to check unused /*global ... */ declarations.

    valueof committed
    Since /*global ... */ implies that variables declared there are
    used throughout the file it makes sense for option 'unused' to
    warn when they are not, in fact, being used.
    Implementation is kind of hacky: I had to add a new object
    'declared' because 'predefined' contains all globals--even those
    defined by options such as 'jQuery'.
    As a smoke test I enabled 'unused' for JSHint files and found
    a few unused vars and mistyped /*global ... */ declarations.
    Closes GH-583.
Commits on Aug 1, 2012
  1. @valueof

    Warn about unused variables and functions.

    valueof committed
    This patch adds a new option, unused, that makes JSHint warn whenever
    it encounters a variable or a function that was defined but never
        function add(a, b) {
            var c = 5;
            var d = 10;
            return a + c;
        // Line 1: 'b' is defined but never used.
        // Line 3: 'd' is defined but never used.
    Implementation details:
    JSHint marks unused variables with type `unused` and unused functions
    with type `unction` (don't ask why `unction`, I don't know). However
    this generated scope tree doesn't provide any additional information
    aside from variable name and its type. So I added a new special field,
    '(tokens)' that contains a dictionary of tokens of all variables and
    functions declared within this scope. This way once I have an unused
    variable I can pretty easily look up its token just by the name.
    Function params were, for whatever reason, marked as type 'parameter'
    that wasn't actually used anywhere else. I changed it to 'unused' so
    that JSHint could catch params that are never used.
    There is also a special key: a variable named 'undefined'. JSHint
    assumes that such variables are part of the popular defensive pattern
    and doesn't consider such variables as unused. Otherwise I'd had to
    treat 'undefined' as a variable everywhere and that's too much work.
    There is a unit test that tests most obvious combinations. In addition
    to that I enabled this option for our jQuery 1.7 regression test and
    checked all newly generated warnings manually.
    Closes GH-582.
    Closes GH-127.
Commits on Jul 31, 2012
  1. @valueof

    Convert all single quotes into double quotes in jshint.js

    valueof committed
    This is useful for:
     * Consistency throughout the file
     * Dogfooding 'quotmark' option
Commits on Jul 30, 2012
  1. @valueof

    Ignore option.quotmark when parsing /*members

    valueof committed
    There is no point in enforcing option.quotmark when parsing /*members
    since the control comment is specific to JSHint.
  2. @valueof

    Make quotmark to work via /*jshint ... */ syntax.

    valueof committed
    Apparently, the newly introduced quotmark option doesn't work
    via /*jshint ... */ syntax which is bad because all options
    must be settable through all channels.
    This patch fixes that.
  3. @valueof

    Don't default to rhino=true in the Rhino wrapper.

    valueof committed
    Defauling to the Rhino environment when Rhino is only used to run
    JSHint is counter-intuitive and not aligned with other wrappers
    such as Node.
    Closes GH-507.
  4. @valueof

    Merge pull request #598 from goatslacker/gh-xxx-2

    valueof committed
    Bug fix, give proper character count for supernew and return identifier
  5. @valueof

    Don't extend String.prototype with non-standard methods.

    valueof committed
    Extending String.prototype is generally a not very wise idea
    that leads to embarassing bugs such as GH-518. This patch
    removes all instances of JSHint extending String.prototype
    with non-standard methods and removes two of them completely
    because they were not used.
    Closes GH-518.
Commits on Jul 29, 2012
  1. @goatslacker
Commits on Jul 27, 2012
  1. @valueof


    valueof committed is a weird, untested method that simply wraps into HTML. I don't think presentation is JSHINT's job
    and I don't want to port it to Next so I thought I would just kill
    it here.
  2. @valueof

    Make exports writeable in Node.

    valueof committed
    Apparently in Node people do `exports = module.exports = foo();` so
    we need to make exports global variable writeable in the Node
    Closes GH-480.
  3. @goatslacker @valueof
  4. @valueof

    Improvements for nomen and camelcase options.

    valueof committed
    I've decided to refactor our identifier checking code a bit and while
    doing refactoring incorporated improvements for nomen and camelcase
    options from GH-581 and GH-596:
     * nomen now recognizes underscore.js global (_)
     * camelcase now allows variables with leading underscores since it
       is one of the most common patterns for pseudo-private variables
       in JavaScript.
    Thanks for Rod Vagg (rvagg) and Nikolay Frantsev (Shutnik) for their
Commits on Jul 24, 2012
  1. @valueof

    Error on invalid JSHINT(...) input

    valueof committed
    This patch makes JSHint to return an error whenever you try to use
    the function with an invalid first parameter. First parameter has
    to be either a non-empty string or a non-empty array.
    Closes GH-567.
  2. @valueof

    Fixed failing regression test

    valueof committed
    We introduced a bunch of changes to how we handle mixed spaces and
    tabs and those changes removed a few warnings that JSHint throws
    for jQuery 1.7 source code.
Commits on Jul 11, 2012
  1. @goatslacker

    Fixes lint warning

    goatslacker committed
Something went wrong with that request. Please try again.