diff --git a/.gitmodules b/.gitmodules index 2d913c4..e69de29 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +0,0 @@ -[submodule "jshint"] - path = res/jshint - url = git@github.com:jshint/jshint.git diff --git a/CNAME b/CNAME new file mode 100644 index 0000000..26ea99b --- /dev/null +++ b/CNAME @@ -0,0 +1 @@ +jshint.com diff --git a/Makefile b/Makefile deleted file mode 100644 index be3abfe..0000000 --- a/Makefile +++ /dev/null @@ -1,22 +0,0 @@ -DEPLOY_BRANCH ?= master -DEPLOY_REMOTE ?= upstream - -node_modules: package.json - npm install - -site: node_modules res - git submodule update - npm run build - -.PHONY: deploy -deploy: site - git checkout -B $(DEPLOY_BRANCH) - git ls-files * | xargs git rm - rmdir --ignore-fail-on-non-empty --parents */ - mv site/* . - rm -rf res/jshint/node_modules - echo "jshint.com" > CNAME - git add --all . - git commit -m "Build site." - git push --force $(DEPLOY_REMOTE) $(DEPLOY_BRANCH) - git checkout - diff --git a/about/index.html b/about/index.html new file mode 100644 index 0000000..3a5ab5d --- /dev/null +++ b/about/index.html @@ -0,0 +1,192 @@ + + + + + About JSHint + + + + + + + + + + + + + + + + + + + + +
+
+
+

This page's content is sourced from the JSHint project repository. If you spot an error, please open an issue or (better yet) make a pull request!

+ +

JSHint, A Static Code Analysis Tool for JavaScript

+ +

[ Use it online • +DocsFAQ • +Install • +Contribute • +BlogTwitter ]

+ +

NPM version +Linux Build Status +Windows Build status +Dependency Status +devDependency Status +Coverage Status

+ +

JSHint is a community-driven tool that detects errors and potential problems in +JavaScript code. Since JSHint is so flexible, you can easily adjust it in +the environment you expect your code to execute. JSHint is open source and +will always stay this way.

+ +

Our goal

+ +

The project aims to help JavaScript developers write complex programs +without worrying about typos and language gotchas.

+ +

Any code base eventually becomes huge at some point, so simple mistakes — that +would not show themselves when written — can become show stoppers and add +extra hours of debugging. So, static code analysis tools come into play +and help developers spot such problems. JSHint scans a program written in +JavaScript and reports about commonly made mistakes and potential bugs. The +potential problem could be a syntax error, a bug due to an implicit type +conversion, a leaking variable, or something else entirely.

+ +

Only 15% of all programs linted on jshint.com pass the +JSHint checks. In all other cases, JSHint finds some red flags that could've +been bugs or potential problems.

+ +

Please note, that while static code analysis tools can spot many different kind +of mistakes, it can't detect if your program is correct, fast or has memory +leaks. You should always combine tools like JSHint with unit and functional +tests as well as with code reviews.

+ +

Reporting a bug

+ +

To report a bug simply create a +new GitHub Issue and describe +your problem or suggestion. We welcome all kinds of feedback regarding +JSHint including but not limited to:

+ +
  • When JSHint doesn't work as expected
  • When JSHint complains about valid JavaScript code that works in all browsers
  • When you simply want a new option or feature
+ +

Before reporting a bug, please look around to see if there are any open or closed tickets +that discuss your issue, and remember the wisdom: pull request > bug report > tweet.

+ +

Who uses JSHint?

+ +

Engineers from these companies and projects use JSHint:

+ + + +

And many more!

+ +

License

+ +

Most files are published using the standard MIT Expat +license. One file, +however, is provided under a slightly modified version of that license. The +so-called JSON license +is a non-free license, and unfortunately, we can't change it due to historical +reasons. This license is included as an in-line within the file it concerns.

+ +

The JSHint Team

+ +

JSHint is currently maintained by Rick Waldron, +Caitlin Potter, Mike +Pennisi, and Luke +Page.

+ +

Previous Maintainers

+ +

Originating from the JSLint project in 2010, JSHint has been maintained by a +number of dedicated individuals. In chronological order, they are: Douglas +Crockford, Anton Kovalyov, and Mike Sherov. We appreciate their long-term +commitment!

+ +

Thank you!

+ +

We really appreciate all kinds of feedback and contributions. Thanks for using and supporting JSHint!

+
+ +
+ + + +
+
+
+ + + + diff --git a/atom.xml b/atom.xml new file mode 100644 index 0000000..a82b432 --- /dev/null +++ b/atom.xml @@ -0,0 +1,479 @@ + + + +JSHint + + +2017-01-07T18:35:23-05:00 +http://jshint.com/ + + + + New Release: 2.9.4 + The JSHint team + + 2016-10-20T00:00:00-04:00 + /blog/2016-10-20/release-2-9-4 + + + + + New Release: 2.9.3 + The JSHint team + + 2016-08-18T00:00:00-04:00 + /blog/2016-08-18/release-2-9-3 + + + + + New Release: 2.9.2 + The JSHint team + + 2016-04-19T00:00:00-04:00 + /blog/2016-04-19/release-2-9-2 + + + + + New Release: 2.9.1 + The JSHint team + + 2016-01-14T00:00:00-05:00 + /blog/2016-01-14/release-2-9-1 + + + + + New Release: 2.9.1-rc3 + The JSHint team + + 2016-01-12T00:00:00-05:00 + /blog/2016-01-12/release-2-9-1-rc3 + + + + + New Release: 2.9.1-rc2 + The JSHint team + + 2015-12-22T00:00:00-05:00 + /blog/2015-12-22/release-2-9-1-rc2 + + + + + New Release: 2.9.1-rc1 + The JSHint team + + 2015-11-12T00:00:00-05:00 + /blog/2015-11-12/release-2-9-1-rc1 + + + + + New Release: 2.9.0 + The JSHint team + + 2015-09-03T00:00:00-04:00 + /blog/2015-09-03/release-2-9-0 + + + + + A Formal Commitment to New Language Features + The JSHint team + + 2015-07-07T00:00:00-04:00 + /blog/new-lang-features + + + + + New Release: 2.8.0 + The JSHint team + + 2015-05-31T00:00:00-04:00 + /blog/2015-05-31/release-2-8-0 + + + + + New Release: 2.7.0 + The JSHint team + + 2015-04-10T00:00:00-04:00 + /blog/2015-04-10/release-2-7-0 + + + + + New Release: 2.6.3 + The JSHint team + + 2015-02-28T00:00:00-05:00 + /blog/2015-02-28/release-2-6-3 + + + + + New Release: 2.6.2 + The JSHint team + + 2015-02-28T00:00:00-05:00 + /blog/2015-02-28/release-2-6-2 + + + + + New Release: 2.6.1 + The JSHint team + + 2015-02-27T00:00:00-05:00 + /blog/2015-02-27/release-2-6-1 + + + + + New Release: 2.6.0 + The JSHint team + + 2015-01-21T00:00:00-05:00 + /blog/2015-01-21/release-2-6-0 + + + + + What's new in JSHint (December, 2013) + Anton Kovalyov + + 2013-12-27T00:00:00-05:00 + /blog/new-in-jshint-dec-2013 + + + + + What's new in JSHint (October, 2013) + Anton Kovalyov + + 2013-10-21T00:00:00-04:00 + /blog/new-in-jshint-oct-2013 + + + + + JSHint 3 plans + Anton Kovalyov + + 2013-10-08T00:00:00-04:00 + /blog/jshint-3-plans + + + + + New JSHint website + Anton Kovalyov + + 2013-10-01T00:00:00-04:00 + /blog/new-site + + + + + New Release: 2.1.10 + Anton Kovalyov + + 2013-08-15T00:00:00-04:00 + /blog/2013-08-15/release-2-1-10 + + + + + JSHint 2.1.10 + Anton Kovalyov + + 2013-08-15T00:00:00-04:00 + /blog/jshint-2-1-10 + + + + + Better integration with NPM + Anton Kovalyov + + 2013-08-02T00:00:00-04:00 + /blog/better-npm-integration + + + + + ES6 default parameters + Anton Kovalyov + + 2013-07-31T00:00:00-04:00 + /blog/es6-default-parameters + + + + + New Release: 2.1.6 + Anton Kovalyov + + 2013-07-29T00:00:00-04:00 + /blog/2013-07-29/release-2-1-6 + + + + + Fun little numbers + Anton Kovalyov + + 2013-07-29T00:00:00-04:00 + /blog/2013-07-29/stats + + + + + JSHint 2.1.6 + Anton Kovalyov + + 2013-07-28T00:00:00-04:00 + /blog/2013-07-28/2-1-6 + + + + + New Release: 2.1.0 + Anton Kovalyov + + 2013-05-21T00:00:00-04:00 + /blog/2013-05-21/release-2-1-0 + + + + + JSHint 2.1.0 + Anton Kovalyov + + 2013-05-20T00:00:00-04:00 + /blog/2013-05-20/2-1-0 + + + + + New Release: 2.0.0 + Anton Kovalyov + + 2013-05-08T00:00:00-04:00 + /blog/2013-05-08/release-2-0-0 + + + + + JSHint 2.0.0 + Anton Kovalyov + + 2013-05-07T00:00:00-04:00 + /blog/2013-05-07/2-0-0 + + + + + JSHint 1.1.0 is out + Anton Kovalyov + + 2013-03-05T00:00:00-05:00 + /blog/2013-03-05/1-1-0 + + + + + JSHint 1.0.0 is out + Anton Kovalyov + + 2013-02-27T00:00:00-05:00 + /blog/2013-02-27/1-0-0 + + + + + JSHint 1.0.0 RC4 + Anton Kovalyov + + 2013-01-18T00:00:00-05:00 + /blog/2013-01-18/1-0-0-rc4 + + + + + New Release: 1.0.0-rc4 + Anton Kovalyov + + 2013-01-18T00:00:00-05:00 + /blog/2013-01-18/release-1-0-0-rc4 + + + + + New Release: 1.0.0-rc3 + Anton Kovalyov + + 2013-01-02T00:00:00-05:00 + /blog/2013-01-02/release-1-0-0-rc3 + + + + + JSHint 1.0.0 RC3 + Anton Kovalyov + + 2013-01-01T00:00:00-05:00 + /blog/2013-01-01/1-0-0-rc3 + + + + + JSHint 1.0.0 RC2 + Anton Kovalyov + + 2012-12-31T00:00:00-05:00 + /blog/2012-12-31/1-0-0-rc2 + + + + + New Release: 1.0.0-rc2 + Anton Kovalyov + + 2012-12-31T00:00:00-05:00 + /blog/2012-12-31/release-1-0-0-rc2 + + + + + JSHint 1.0.0 RC1 + Anton Kovalyov + + 2012-12-29T00:00:00-05:00 + /blog/2012-12-29/1-0-0-rc1 + + + + + New blog + Anton Kovalyov + + 2012-10-24T00:00:00-04:00 + /blog/2012-10-24/new-blog + + + + + New release: r12 + Anton Kovalyov + + 2012-09-25T00:00:00-04:00 + /blog/2012-09-25/release-r12 + + + + + New release: r11 + Anton Kovalyov + + 2012-09-03T00:00:00-04:00 + /blog/2012-09-03/new-release-r11 + + + + + New release: r10 + Anton Kovalyov + + 2012-08-20T00:00:00-04:00 + /blog/2012-08-20/release-r10 + + + + + New release: r09 + Anton Kovalyov + + 2012-08-05T00:00:00-04:00 + /blog/2012-08-05/release-r09 + + + + + New release: r08 + Anton Kovalyov + + 2012-07-26T00:00:00-04:00 + /blog/2012-07-26/release-r08 + + + + + New release: r07 + Anton Kovalyov + + 2012-05-01T00:00:00-04:00 + /blog/2012-05-01/release-r07 + + + + + Bugfix release: r06 + Anton Kovalyov + + 2012-02-13T00:00:00-05:00 + /blog/2012-02-13/release-r06 + + + + + New release: r05 + Anton Kovalyov + + 2012-01-19T00:00:00-05:00 + /blog/2012-01-19/release-r05 + + + + + Bugfix release: r04 + Anton Kovalyov + + 2012-01-08T00:00:00-05:00 + /blog/2012-01-08/release-r04 + + + + + New release: r03 + Anton Kovalyov + + 2011-12-30T00:00:00-05:00 + /blog/2011-12-30/release-r03 + + + + + New release: r02 + Anton Kovalyov + + 2011-12-23T00:00:00-05:00 + /blog/2011-12-23/release-r02 + + + + + Hello + Anton Kovalyov + + 2011-12-20T00:00:00-05:00 + /blog/hello + + + + diff --git a/blog/2011-12-20/hello/index.html b/blog/2011-12-20/hello/index.html new file mode 100644 index 0000000..4c7fc69 --- /dev/null +++ b/blog/2011-12-20/hello/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/blog/2011-12-23/release-r02/index.html b/blog/2011-12-23/release-r02/index.html new file mode 100644 index 0000000..692b44f --- /dev/null +++ b/blog/2011-12-23/release-r02/index.html @@ -0,0 +1,95 @@ + + + + + New release: r02 + + + + + + + + + + + + + + + + + + + + +
+
+
+

New release: r02

+ + + +

A huge [1] number of tweaks and bugfixes. New options: funcscope, esnext, +multistr and smarttabs. To see what they do, refer to the docs.

+ +

Many thanks to our awesome contributors who participated in this release: +Wolfgang Kluge, Josh Perez, Ben Blank, Rob Friesel, Matt, Nicholas Zakas, +dionyziz, Ed Lui, Felix Gnass, Tom Rix, Dominic Barnes, Nick Goris, Nicolas +Ferrero, Ron DeVera, Sean Carpenter, shahyar, Aparajita Fishman, ckknight, +Jakub Suder and Dylan Smith.

+ +

[1] — Since it's been a few months this release is too big to summarzie. +Future releases will be smaller and easier to summarize.

+
+
+
+ + + + diff --git a/blog/2011-12-30/release-r03/index.html b/blog/2011-12-30/release-r03/index.html new file mode 100644 index 0000000..a8e3ae9 --- /dev/null +++ b/blog/2011-12-30/release-r03/index.html @@ -0,0 +1,106 @@ + + + + + New release: r03 + + + + + + + + + + + + + + + + + + + + +
+
+
+

New release: r03

+ + + +

This release contains significant improvements to the way JSHint +treats ES5 accessor functions:

+ +
  • Getters no longer raise the “Don't make functions within a loop” +warnings.

  • JSHint no longer enforces value as a parameter name for setter +functions.

  • JSHint no longer requires setter functions to follow getters.

  • Improved checks for duplicate properties. For example, JSHint now +understands that this code is valid:

    x = {
    +      get x: function () {},
    +        set x: function () {}
    +    };

    While this one is not:

    x = {
    +      get x: function () {},
    +        x: true
    +    };
  • Tests cover more use cases with ES5 accessors.

  • Fixed a bug with JSHint producing false warning for the following +code:

    somevar.replace(/[0-9-]/g, "");
+ +

Thanks to Máté Farkas and Wolfgang Kluge.

+ +

Welcome Wolfgang and Josh!

+ +

Please welcome new JSHint Core team members Wolfgang Kluge and Josh Perez! +I'm really excited to work with them on making JSHint the best code quality +tool for JavaScript.

+
+
+
+ + + + diff --git a/blog/2012-01-08/release-r04/index.html b/blog/2012-01-08/release-r04/index.html new file mode 100644 index 0000000..9eac862 --- /dev/null +++ b/blog/2012-01-08/release-r04/index.html @@ -0,0 +1,95 @@ + + + + + Bugfix release: r04 + + + + + + + + + + + + + + + + + + + + +
+
+
+

Bugfix release: r04

+ + + +

This is a bugfix release that also contains some improvements to our +test coverage.

+ +

Fixes:

+ +
  • JSHint now makes sure that null references are not subscripted +within typeof and delete operators.

  • JSHint now recognizes defensive semicolon technique:

    ; (function () { / ... / }());

    But still warns in cases like this:

    ; function () {}
  • Fixed an issue with latedef not working for a specific use +of variable hoisting.

  • Fixed an intermittent bug with JSHint failing with an exception +instead of returning a Too Many errors message.

  • Fixed incorrect comments in JSC wrapper.

  • Fixed a bug with JSC wrapper not parsing options with spaces correctly.

+ +

Thanks to Mike Pennisi and Dan Vanderkam.

+
+
+
+ + + + diff --git a/blog/2012-01-19/release-r05/index.html b/blog/2012-01-19/release-r05/index.html new file mode 100644 index 0000000..fb0ead2 --- /dev/null +++ b/blog/2012-01-19/release-r05/index.html @@ -0,0 +1,105 @@ + + + + + New release: r05 + + + + + + + + + + + + + + + + + + + + +
+
+
+

New release: r05

+ + + +

This release improves JSHint's support for variable hoisting. JSHint +now fully understands variable hoisting:

+ +
/*jshint undef:true */
+
+    function func() {
+      function innerOne() {
+          // Before: wrong error.
+            // Now: knows that innerTwo is defined below.
+            innerTwo();
+        }
+
+        function innerTwo() {
+        }
+    }
+ +

We also added a new option, laxcomma, that allows you to use +comma-first coding style without turning on the laxbreak option. See +GH-340 for more information.

+ +

Thanks to Charlie Robbins.

+
+
+
+ + + + diff --git a/blog/2012-02-13/release-r06/index.html b/blog/2012-02-13/release-r06/index.html new file mode 100644 index 0000000..8380a82 --- /dev/null +++ b/blog/2012-02-13/release-r06/index.html @@ -0,0 +1,88 @@ + + + + + Bugfix release: r06 + + + + + + + + + + + + + + + + + + + + +
+
+
+

Bugfix release: r06

+ + + +

This is a minor bugfix release that fixes a couple of issues with +hoisting and IIFE.

+ +

Thanks to Kyle Robinson Young.

+
+
+
+ + + + diff --git a/blog/2012-05-01/release-r07/index.html b/blog/2012-05-01/release-r07/index.html new file mode 100644 index 0000000..36145b6 --- /dev/null +++ b/blog/2012-05-01/release-r07/index.html @@ -0,0 +1,90 @@ + + + + + New release: r07 + + + + + + + + + + + + + + + + + + + + +
+
+
+

New release: r07

+ + + +
  • New globals for the browser option.

  • WSH wrapper now supports recursive directories.

  • Support for \0 in strings. +(GH-464)

  • Node environment now assumes globalstrict.

  • Opt-in support for the with statement.

  • Rhino wrapper is now runnable.

  • + lot of bugfixes.

+ +

Thanks to Antal István Miklós, Brent Lintner, Domenic Denicola, +Fábio M. Costa, J-Griffin, Kevin Locke, Nikolay Frantsev, +Peter Wagenet and Rick Waldron.

+
+
+
+ + + + diff --git a/blog/2012-07-26/release-r08/index.html b/blog/2012-07-26/release-r08/index.html new file mode 100644 index 0000000..16ef55c --- /dev/null +++ b/blog/2012-07-26/release-r08/index.html @@ -0,0 +1,94 @@ + + + + + New release: r08 + + + + + + + + + + + + + + + + + + + + +
+
+
+

New release: r08

+ + + +

This release introduces a new option—quotmark. This option allows +you to enforce the consistency of quotation marks.

+ +

Other changes:

+ +
  • New globals for the WebWorker API.

  • New globals for the browser option.

  • New option camelcase. If set to true, all identifiers are required +to be either in camelCase or UPPER_CASE with underscores.

  • + bugfixes.

+ +

Thanks for Jan Prachar, Jason More, Rick Waldron, Joel Brandt, Akshar Prabhu +Desai, Paul O'Shannessy and Rob Friesel.

+
+
+
+ + + + diff --git a/blog/2012-08-05/release-r09/index.html b/blog/2012-08-05/release-r09/index.html new file mode 100644 index 0000000..63053a5 --- /dev/null +++ b/blog/2012-08-05/release-r09/index.html @@ -0,0 +1,96 @@ + + + + + New release: r09 + + + + + + + + + + + + + + + + + + + + +
+
+
+

New release: r09

+ + + +

This release introduces a new option called unused. This option +allows you to quickly spot variables that were defined but never used.

+ +

Other changes:

+ +
  • Fixes and improvements for our new option quotmark from +r08.
  • Rhino wrapper now accepts shortcuts for predefined globals:

    $ rhino jshint-rhino.js myfile.js undef:true myglobal

    Also, it no longer assumes rhino=true for all files.

  • We removed JSHINT.report (it used to generate HTML based on JSHint +output).
  • We changed camelcase to tolerate variables with leading underscores +since it is one of the most common patterns for pseudo-private variables +in JavaScript.
  • nomen now recognizes Underscore.js global.
  • + other minor bugfixes.
+ +

Thanks to Rod Vagg and Nikolay Frantsev.

+
+
+
+ + + + diff --git a/blog/2012-08-20/release-r10/index.html b/blog/2012-08-20/release-r10/index.html new file mode 100644 index 0000000..5baf57e --- /dev/null +++ b/blog/2012-08-20/release-r10/index.html @@ -0,0 +1,104 @@ + + + + + New release: r10 + + + + + + + + + + + + + + + + + + + + +
+
+
+

New release: r10

+ + + +

This release introduces lots of improvements to the unused option from +r09. For example, JSHint is now smart +enough to not to warn about unused variable if that variable is followed +by a used one:

+ +
fetch(function (err, msg) {
+      success(msg);
+  });
+ +

We also fixed JSHINT.data().unused to be consistent with this option.

+ +

Other changes:

+ +
  • You can now exclude globals. For example, if you want to assume browser +environment but disallow the use of event you can do the following:

    /jshint browser:true / + /global -event /

  • JSHint now recognizes (function () {})(); as well as +(function () {}());.

  • JSHint can now parse labeled and lonely blocks without generating +false positives.
  • + other bugfixes.
+ +

Thanks to Amir E. Aharoni and Carl Ekerot.

+
+
+
+ + + + diff --git a/blog/2012-09-03/new-release-r11/index.html b/blog/2012-09-03/new-release-r11/index.html new file mode 100644 index 0000000..40c9929 --- /dev/null +++ b/blog/2012-09-03/new-release-r11/index.html @@ -0,0 +1,106 @@ + + + + + New release: r11 + + + + + + + + + + + + + + + + + + + + +
+
+
+

New release: r11

+ + + +

This release adds new checks for excessive code! You can now use JSHint +to check number of parameters per function, nested block depth per function, +number of statements per function and function's cyclomatic complexity. +More information in our docs or in this brilliant +patch.

+ +

Other changes:

+ +
  • Fixed bugs where JSHint couldn't parse Number.NaN and ES5 sparse arrays.
  • Fixed bugs where JSHint couldn't parse some confusing regular expressions.
  • catch blocks now has their own scope so if you define a function within +a catch block and try to use it outside of said block—JSHint will warn you +about undefined variable. JSHint also warns about cases when the catch +scope leaks values into the outer scope in IE:

    var e = 2;

    try { + throw 'boom'; + } catch (e) { + // JSHint: 'e' may get overwritten in IE. + }

    console.log(e + 2); // 'boom2' instead of 4

  • We no longer warn when Object is used as a function. Like Boolean, Number +and String, Object can be called as a function which provides scripts with +access to ECMAScript's internal ToObject logic.

  • We no longer warn when uncapitalized global functions are used as constructors.
  • JSHint now recognizes some ES6 globals (Map, Set and WeakMap) and one +additional browser global Blob.
  • Updated our list of globals for MooTools.
  • JSHint can now check code within simple eval strings. For example, JSHint can +now spot typos like this one (this practice is still discouraged, though):

    eval("oops("); // Expected ')' and instead saw ''.

  • + other minor bugfixes.

+ +

Thanks to Josh Heidenreich, Rick Waldron, Nikolay Frantsev, shybyte.

+
+
+
+ + + + diff --git a/blog/2012-09-25/release-r12/index.html b/blog/2012-09-25/release-r12/index.html new file mode 100644 index 0000000..90595d7 --- /dev/null +++ b/blog/2012-09-25/release-r12/index.html @@ -0,0 +1,91 @@ + + + + + New release: r12 + + + + + + + + + + + + + + + + + + + + +
+
+
+

New release: r12

+ + + +

This is mostly a bugfix release:

+ +
  • Fixed a bug where indent behaved differently when passed as +as an argument to JSHint.
  • Fixed a bug where maxparams check was failing on functions +with no parameters.
  • New predefined globals for YUI.
+ +

Thanks to Dav Glass, Mariusz Nowak and Brad Harris.

+
+
+
+ + + + diff --git a/blog/2012-10-24/new-blog/index.html b/blog/2012-10-24/new-blog/index.html new file mode 100644 index 0000000..b4d87ce --- /dev/null +++ b/blog/2012-10-24/new-blog/index.html @@ -0,0 +1,109 @@ + + + + + New blog + + + + + + + + + + + + + + + + + + + + +
+
+
+

New blog

+ + + +

Welcome to the official JSHint blog. This blog will serve two purposes. +First, it will replace our old Changelog page where we announce new JSHint +releases. Second, I will use this blog as a platform to share stuff about +static code analysis I find interesting.

+ +

For example, Ariya Hidayat (of Esprima and PhantomJS) gave what seems to +be a very nice talk a few days ago at the EmpireJS. His slides are embedded +below.

+ +
+
+ + + +

Oh and check out jshint.com, it has a cool new header.

+
+
+
+ + + + diff --git a/blog/2012-12-29/1-0-0-rc1/index.html b/blog/2012-12-29/1-0-0-rc1/index.html new file mode 100644 index 0000000..77b93ae --- /dev/null +++ b/blog/2012-12-29/1-0-0-rc1/index.html @@ -0,0 +1,250 @@ + + + + + JSHint 1.0.0 RC1 + + + + + + + + + + + + + + + + + + + + +
+
+
+

JSHint 1.0.0 RC1

+ + + +

UPDATE: JSHint 1.0.0 RC3.

+ +
+ +

After three months and 100+ commits, JSHint 1.0.0 is ready for release. +This is the biggest release for JSHint so far, and that's why I've decided to run it +through a release candidate phase first. I tried my best to make it as +backwards compatible as possible, but there might be a small number of +incompatibilities depending on how you use JSHint. Please keep that in mind +and test your integration before updating to 1.0.0.

+ +

One of the biggest changes is that node-jshint is now part of the main JSHint +project, which means that there will no longer be lag time between releasing a +new version and publishing it on NPM. Node and NPM is now the main and +recommended way of using JSHint on all platforms. This also means that +starting with "1.0.0", JSHint will start using the +node-semver versioning system instead +of the old rN system.

+ +

In addition, this version drops support for non-ES5 environments. This means that +JavaScript engines that don't support the ES5 syntax will not even parse +JSHint's source code. (For example, the online interface for JSHint will not +work in older versions of IE.)

+ +

I'm very excited to finally release this version and I encourage everyone to try +out the release candidate and report any bugs and issues you encounter. The full +changelog is provided below, with examples and links to relevant issues.

+ +

Parser

+ +

This version has a completely rewritten lexer. Since it's no longer a giant +regexp, the new lexer is more robust and easier to read. I'd like to thank the +authors of Esprima and Traceur since I borrowed some pieces from them.

+ +
  • This version adds support for Unicode identifiers! +(#301 and +#716)

    var π = 3.1415;

  • Adds support for the comma operator. (#56) +JSHint now parses code like the following (note the comma in the middle +expression):

    for (var i = 0, ch; ch = channels[i], i < channels.length; i++) { + // ... + }

  • Improves support for numbers. JSHint now understands numbers with leading dots +(e.g. .12) and doesn't generate false positives on invalid numbers (e.g. 099). +In case of invalid numbers the parser still parses them but marks as +malformed and generates a nice little warning.

  • Adds support for more relaxed JSHint directive syntax. JSHint now recognizes +space between /* and jshint/global/etc. and allows you to use single-line +comments for directives in addition to multi-line comments:

    Before: + /jshint strict:true /

    Now: + /jshint strict:true / + / jshint strict:true / (note the space) + //jshint strict:true + // jshint strict:true

    One potentially breaking change is that all lists inside JSHint directives +must be separated by commas from now on. So /*jshint strict:true undef:true */ +won't fly anymore but /*jshint strict:true, undef:true */ will (note the +comma).

  • Adds better parser for regular expressions. Previously, JSHint would check +the grammar of regular expressions using its own internal logic. Now, JSHint +compiles the parsed expressions using the native RegExp object to check +for grammar errors.

  • Adds support for a defensive semicolon before [. (Ticket +#487)

  • Adds support for unclosed multi-line strings and removes warnings about +unnecessary escaping for \u and \x in strings. +(#494)

+ +

Bug fixes:

+ +
  • Fixes a bug with JSHint not warning about reserved words being used as +variable and function declaration identifiers. (Ticket +#744)

  • Fixes a bug with JSHint generating a false positive Missing whitespace... +warning on trailing commas. +(#363)

  • Fixes a bug with JSHint not being able to parse regular expressions preceded +by typeof (e.g. typeof /[a-z]/) and, in some cases, *=, /=, etc. +(e.g. if (x /= 2) { ... }). +(#657)

+ +

General

+ +
  • This version adds a unique numeric code to every warning and error message +produced by JSHint. That means that you can now ignore any warning +produced by JSHint even when there is no corresponding option for it. You can +do that using the special minus (-) operator. For example, here's how you +ignore all messages about trailing decimal points (W047):

    /jshint -W047 /

    or

    JSHINT(src, { "-W047": true });

    Keep in mind that this syntax can't be used to ignore errors.

  • Due to popular demand, this version splits indent and white options +meaning that indent won't imply white anymore. +(#667)

  • Changes node option to not assume that all programs must be +running in strict mode. +(#721)

  • Adds new globals for the browser option: Element and Uint8ClampedArray. +(#707 and +#766)

  • Adds new global for the node option: DataView. +(#773 and +#774)

  • Removes option onecase.

  • Adds new directive: exported. Use /* exported ... for global variables +that are defined in the current file but used elsewhere to prevent +unnecessary X is defined but never used warnings. As before, you need to declare those +variables as global in the other files.

    (#726 and +#659)

  • Removes a warning about missing break before default when default +is the first switch statement (#490):

    switch (name) { + default: // No warning here + doSomething(); + break; + case "JSHint": + doSomethingElse(); + }

  • Improves support for future reserved keywords. +JSHint now properly recognizes future reserved keywords both for ES3 and ES5 +environments with their corresponding rules. +(#674)

  • Changes behavior for hasOwnProperty (#770):

    var hasOwnProperty = ...; // No warning + var obj = { hasOwnProperty: ... }; // Warning + obj.hasOwnProperty = ...; // Warning + obj['hasOwnProperty'] = ...; // Warning

  • Adds ability to disable option unused per function! +(#639)

    // jshint unused:true + var a; // Warning

    function foo(b) { // No warning + // jshint unused:false + return 1; + }

    foo();

+ +

Bug fixes:

+ +
  • Adds scope property to critical errors. (#714)
  • Fixes a regression bug with option predef making all global variables +writeable. (#665)
  • Fixes a bug with JSHint not warning about potential typos on return o.a = 1. +(#670)
  • Fixes a bug with implied property containing false positive data when +option undef is off. +(#668)
+ +

CLI

+ +
  • This version removes support for the JavaScriptCore shell due to its +limited API. Note that this doesn't mean that JSHint no longer works in +Safari, it simply means that we removed the ability to use jshint via the command +line JSC shell.

  • This version also removes support for Windows Script Host. WSH support +was initially added due to Node not working well on Windows but, thanks to +Microsoft engineers, this is no longer true. So everyone is encouraged to +use JSHint with Node.

  • This version relies on ES5 syntax, so if you use JSHint with +Rhino, please make sure you have the latest version: 1.7R4.

+ +

This version includes several improvements to the Node version of JSHint:

+ +
  • Adds a new flag, --verbose, that changes output to display message codes:

    $ jshint --verbose my.js + my.js: line 7, col 23, Extra comma. (...) (W070)

  • Makes --config raise an error if it can't find provided file or if the +file is invalid JSON. +(#691)

+ +

Bug fixes:

+ +
  • Fixes a bug with .jshintignore globbing not working properly. +(#777 and +#692)

  • Fixes a bug with JSHint skipping over files with no extensions. +(#690)

+ +

What's next?

+ +

I plan to test this release candidate for about a week before marking it +as stable and publishing on NPM. And, at the same time, I will be updating the +documentation and the jshint.com website. If you notice any +bugs or unexpected backwards-incompatible changes, please file a bug.

+ +

RC3 is out: JSHint 1.0.0 RC3.

+ +

Here's how you can install this release candidate:

+ +
$ npm install https://github.com/jshint/jshint/archive/1.0.0-rc1.tar.gz
+ +

For Rhino wrapper, you will need to clone our repo and build jshint-rhino:

+ +
$ node make.js build
+$ rhino dist/jshint-rhino.js ...
+ +

Contributors

+ +

Thanks to Bernhard K. Weisshuhn, James Allardice, Mike MacCana, Stephen Fry, +Steven Olmsted, Leith Abdulla, Eric Promislow and Vlad Gurdiga for submitting +patches!

+
+
+
+ + + + diff --git a/blog/2012-12-31/1-0-0-rc2/index.html b/blog/2012-12-31/1-0-0-rc2/index.html new file mode 100644 index 0000000..acf2675 --- /dev/null +++ b/blog/2012-12-31/1-0-0-rc2/index.html @@ -0,0 +1,101 @@ + + + + + JSHint 1.0.0 RC2 + + + + + + + + + + + + + + + + + + + + +
+
+
+

JSHint 1.0.0 RC2

+ + + +

JSHint 1.0.0 Release Candidate 2 is now out:

+ +
  • Fixes a bug with JSHint not recognizing regular expressions after commas. +(#792)
  • Fixes two failed tests on Windows. +(#790)
  • Fixes a bug with JSHint builder failing when there is no dist/ directory. +(#788)
  • Adds JSHint binary to package.json so that JSHint could be, once again, +installed and used globally as a CLI program. +(#787)
+ +

Here's how you can install this release candidate:

+ +
$ npm install https://github.com/jshint/jshint/archive/1.0.0-rc2.tar.gz
+ +

For full 1.0.0 changelog please see our +1.0.0 RC1 announcement.

+ +

Big thanks to Samuel Cole for submitting patches and finding bugs!

+
+
+
+ + + + diff --git a/blog/2012-12-31/release-1-0-0-rc2/index.html b/blog/2012-12-31/release-1-0-0-rc2/index.html new file mode 100644 index 0000000..cf2b605 --- /dev/null +++ b/blog/2012-12-31/release-1-0-0-rc2/index.html @@ -0,0 +1,267 @@ + + + + + New Release: 1.0.0-rc2 + + + + + + + + + + + + + + + + + + + + +
+
+
+

New Release: 1.0.0-rc2

+ + + +

JSHint 1.0.0 Release Candidate 2 is now out:

+ +
  • Fixes a bug with JSHint not recognizing regular expressions after commas. +(#792)
  • Fixes two failed tests on Windows. +(#790)
  • Fixes a bug with JSHint builder failing when there is no dist/ directory. +(#788)
  • Adds JSHint binary to package.json so that JSHint could be, once again, +installed and used globally as a CLI program. +(#787)
+ +

Here's how you can install this release candidate:

+ +
$ npm install https://github.com/jshint/jshint/archive/1.0.0-rc2.tar.gz
+ +

For full 1.0.0 changelog please see our +1.0.0 RC1 announcement.

+ +

Big thanks to Samuel Cole for submitting patches and finding bugs!

+ +

1.0.0-rc1 (2012-12-31)

+ +

After three months and 100+ commits, JSHint 1.0.0 is ready for release. This +is the biggest release for JSHint so far, and that's why I've decided to run it +through a release candidate phase first. I tried my best to make it as +backwards compatible as possible, but there might be a small number of +incompatibilities depending on how you use JSHint. Please keep that in mind and +test your integration before updating to 1.0.0.

+ +

One of the biggest changes is that node-jshint is now part of the main JSHint +project, which means that there will no longer be lag time between releasing a +new version and publishing it on NPM. Node and NPM is now the main and +recommended way of using JSHint on all platforms. This also means that +starting with "1.0.0", JSHint will start using the +node-semver versioning system instead +of the old rN system.

+ +

In addition, this version drops support for non-ES5 environments. This means +that JavaScript engines that don't support the ES5 syntax will not even parse +JSHint's source code. (For example, the online interface for JSHint will not +work in older versions of IE.)

+ +

I'm very excited to finally release this version and I encourage everyone to +try out the release candidate and report any bugs and issues you encounter. The +full changelog is provided below, with examples and links to relevant issues.

+ +

Parser

+ +

This version has a completely rewritten lexer. Since it's no longer a giant +regexp, the new lexer is more robust and easier to read. I'd like to thank the +authors of Esprima and Traceur since I borrowed some pieces from them.

+ +
  • This version adds support for Unicode identifiers! +(#301 and +#716)

    var π = 3.1415;

  • Adds support for the comma operator. (#56) +JSHint now parses code like the following (note the comma in the middle +expression):

    for (var i = 0, ch; ch = channels[i], i < channels.length; i++) { + // ... + }

  • Improves support for numbers. JSHint now understands numbers with leading +dots (e.g. .12) and doesn't generate false positives on invalid numbers (e.g. +099). In case of invalid numbers the parser still parses them but marks as +malformed and generates a nice little warning.

  • Adds support for more relaxed JSHint directive syntax. JSHint now recognizes +space between /* and jshint/global/etc. and allows you to use single-line +comments for directives in addition to multi-line comments:

    Before: + /jshint strict:true /

    Now: + /jshint strict:true / + / jshint strict:true / (note the space) + //jshint strict:true + // jshint strict:true

    One potentially breaking change is that all lists inside JSHint directives +must be separated by commas from now on. So /*jshint strict:true undef:true +*/ won't fly anymore but /*jshint strict:true, undef:true */ will (note +the comma).

  • Adds better parser for regular expressions. Previously, JSHint would check +the grammar of regular expressions using its own internal logic. Now, JSHint +compiles the parsed expressions using the native RegExp object to check +for grammar errors.

  • Adds support for a defensive semicolon before [. (Ticket +#487)

  • Adds support for unclosed multi-line strings and removes warnings about +unnecessary escaping for \u and \x in strings. +(#494)

+ +

Bug fixes:

+ +
  • Fixes a bug with JSHint not warning about reserved words being used as +variable and function declaration identifiers. (Ticket +#744)

  • Fixes a bug with JSHint generating a false positive Missing whitespace... +warning on trailing commas. +(#363)

  • Fixes a bug with JSHint not being able to parse regular expressions preceded +by typeof (e.g. typeof /[a-z]/) and, in some cases, *=, /=, etc. (e.g. +if (x /= 2) { ... }). +(#657)

+ +

General

+ +
  • This version adds a unique numeric code to every warning and error message +produced by JSHint. That means that you can now ignore any warning +produced by JSHint even when there is no corresponding option for it. You can +do that using the special minus (-) operator. For example, here's how you +ignore all messages about trailing decimal points (W047):

    /jshint -W047 /

    or

    JSHINT(src, { "-W047": true });

    Keep in mind that this syntax can't be used to ignore errors.

  • Due to popular demand, this version splits indent and white options +meaning that indent won't imply white anymore. +(#667)

  • Changes node option to not assume that all programs must be running in +strict mode. (#721)

  • Adds new globals for the browser option: Element and Uint8ClampedArray. +(#707 and +#766)

  • Adds new global for the node option: DataView. +(#773 and +#774)

  • Removes option onecase.

  • Adds new directive: exported. Use /* exported ... for global variables +that are defined in the current file but used elsewhere to prevent +unnecessary X is defined but never used warnings. As before, you need to +declare those variables as global in the other files.

    (#726 and +#659)

  • Removes a warning about missing break before default when default is +the first switch statement +(#490):

    switch (name) { + default: // No warning here + doSomething(); + break; + case "JSHint": + doSomethingElse(); + }

  • Improves support for future reserved +keywords. +JSHint now properly recognizes future reserved keywords both for ES3 and ES5 +environments with their corresponding rules. +(#674)

  • Changes behavior for hasOwnProperty +(#770):

    var hasOwnProperty = ...; // No warning + var obj = { hasOwnProperty: ... }; // Warning + obj.hasOwnProperty = ...; // Warning + obj['hasOwnProperty'] = ...; // Warning

  • Adds ability to disable option unused per function! +(#639)

    // jshint unused:true + var a; // Warning

    function foo(b) { // No warning + // jshint unused:false + return 1; + }

    foo();

+ +

Bug fixes:

+ +
  • Adds scope property to critical errors. +(#714)
  • Fixes a regression bug with option predef making all global variables +writeable. (#665)
  • Fixes a bug with JSHint not warning about potential typos on return o.a = +1. (#670)
  • Fixes a bug with implied property containing false positive data when +option undef is off. (#668)
+ +

CLI

+ +
  • This version removes support for the JavaScriptCore shell due to its +limited API. Note that this doesn't mean that JSHint no longer works in +Safari, it simply means that we removed the ability to use jshint via the +command line JSC shell.

  • This version also removes support for Windows Script Host. WSH support +was initially added due to Node not working well on Windows but, thanks to +Microsoft engineers, this is no longer true. So everyone is encouraged to use +JSHint with Node.

  • This version relies on ES5 syntax, so if you use JSHint with Rhino, please +make sure you have the latest version: 1.7R4.

+ +

This version includes several improvements to the Node version of JSHint:

+ +
  • Adds a new flag, --verbose, that changes output to display message codes:

    $ jshint --verbose my.js + my.js: line 7, col 23, Extra comma. (...) (W070)

  • Makes --config raise an error if it can't find provided file or if the file +is invalid JSON. (#691)

+ +

Bug fixes:

+ +
  • Fixes a bug with .jshintignore globbing not working properly. +(#777 and +#692)

  • Fixes a bug with JSHint skipping over files with no extensions. +(#690)

+ +

What's next?

+ +

I plan to test this release candidate for about a week before marking it as +stable and publishing on NPM. And, at the same time, I will be updating the +documentation and the jshint.com website. If you notice +any bugs or unexpected backwards-incompatible changes, please file a bug.

+ +

RC3 is out: JSHint 1.0.0 RC3.

+ +

Here's how you can install this release candidate:

+ +
$ npm install https://github.com/jshint/jshint/archive/1.0.0-rc1.tar.gz
+ +

For Rhino wrapper, you will need to clone our repo and build jshint-rhino:

+ +
$ node make.js build
+$ rhino dist/jshint-rhino.js ...
+ +

Contributors

+ +

Thanks to Bernhard K. Weisshuhn, James Allardice, Mike MacCana, Stephen Fry, +Steven Olmsted, Leith Abdulla, Eric Promislow and Vlad Gurdiga for submitting +patches!

+
+
+
+ + + + diff --git a/blog/2013-01-01/1-0-0-rc3/index.html b/blog/2013-01-01/1-0-0-rc3/index.html new file mode 100644 index 0000000..5cb73b2 --- /dev/null +++ b/blog/2013-01-01/1-0-0-rc3/index.html @@ -0,0 +1,98 @@ + + + + + JSHint 1.0.0 RC3 + + + + + + + + + + + + + + + + + + + + +
+
+
+

JSHint 1.0.0 RC3

+ + + +

JSHint 1.0.0 Release Candidate 3 is now out:

+ +
  • Fixes a bug with JSHint not allowing new and debugger to +appear after a comma. (#793)
  • Fixes a bug with JSHint not collecting file recursively. +(#794)
  • Fixes a bug with JSHint crashing when future reserved words are used as +identifiers.
  • Adds a newline separator between files in the CLI output.
  • Fixes a bug with JSHint not parsing /*global global:true */ correctly. +(#795)
  • Fixes a bug with JSHint crashing when files can't be found.
+ +

Here's how you can install this release candidate:

+ +
$ npm install https://github.com/jshint/jshint/archive/1.0.0-rc3.tar.gz
+ +

For full 1.0.0 changelog please see our +1.0.0 RC1 announcement.

+
+
+
+ + + + diff --git a/blog/2013-01-02/release-1-0-0-rc3/index.html b/blog/2013-01-02/release-1-0-0-rc3/index.html new file mode 100644 index 0000000..287ea4c --- /dev/null +++ b/blog/2013-01-02/release-1-0-0-rc3/index.html @@ -0,0 +1,98 @@ + + + + + New Release: 1.0.0-rc3 + + + + + + + + + + + + + + + + + + + + +
+
+
+

New Release: 1.0.0-rc3

+ + + +

JSHint 1.0.0 Release Candidate 3 is now out:

+ +
  • Fixes a bug with JSHint not allowing new and debugger to +appear after a comma. (#793)
  • Fixes a bug with JSHint not collecting file recursively. +(#794)
  • Fixes a bug with JSHint crashing when future reserved words are used as +identifiers.
  • Adds a newline separator between files in the CLI output.
  • Fixes a bug with JSHint not parsing /*global global:true */ correctly. +(#795)
  • Fixes a bug with JSHint crashing when files can't be found.
+ +

Here's how you can install this release candidate:

+ +
$ npm install https://github.com/jshint/jshint/archive/1.0.0-rc3.tar.gz
+ +

For full 1.0.0 changelog please see our 1.0.0 RC1 +announcement.

+
+
+
+ + + + diff --git a/blog/2013-01-18/1-0-0-rc4/index.html b/blog/2013-01-18/1-0-0-rc4/index.html new file mode 100644 index 0000000..e0790d9 --- /dev/null +++ b/blog/2013-01-18/1-0-0-rc4/index.html @@ -0,0 +1,98 @@ + + + + + JSHint 1.0.0 RC4 + + + + + + + + + + + + + + + + + + + + +
+
+
+

JSHint 1.0.0 RC4

+ + + +

JSHint 1.0.0 Release Candidate 4 is now out:

+ +
  • Fixes a bug with JSHint not allowing reserved words to be used as property +names. (#768)
  • Fixes a bug with JSHint lexer not recognizing / after ]. +(#803)
  • Fixes a bug with JSHint not recognizing predef when its value is an array, +and not an object. (#800)
  • Fixes a bug with JSHint crashing on unrecoverable syntax errors such as +if (name <) {}. (#818)
+ +

Here's how you can install this release candidate:

+ +
$ npm install https://github.com/jshint/jshint/archive/1.0.0-rc4.tar.gz
+ +

For full 1.0.0 changelog please see our +1.0.0 RC1 announcement.

+
+
+
+ + + + diff --git a/blog/2013-01-18/release-1-0-0-rc4/index.html b/blog/2013-01-18/release-1-0-0-rc4/index.html new file mode 100644 index 0000000..f7232e5 --- /dev/null +++ b/blog/2013-01-18/release-1-0-0-rc4/index.html @@ -0,0 +1,98 @@ + + + + + New Release: 1.0.0-rc4 + + + + + + + + + + + + + + + + + + + + +
+
+
+

New Release: 1.0.0-rc4

+ + + +

JSHint 1.0.0 Release Candidate 4 is now out:

+ +
  • Fixes a bug with JSHint not allowing reserved words to be used as property +names. (#768)
  • Fixes a bug with JSHint lexer not recognizing / after ]. +(#803)
  • Fixes a bug with JSHint not recognizing predef when its value is an array, +and not an object. (#800)
  • Fixes a bug with JSHint crashing on unrecoverable syntax errors such as +if (name <) {}. (#818)
+ +

Here's how you can install this release candidate:

+ +
$ npm install https://github.com/jshint/jshint/archive/1.0.0-rc4.tar.gz
+ +

For full 1.0.0 changelog please see our +1.0.0 RC1 announcement.

+
+
+
+ + + + diff --git a/blog/2013-02-27/1-0-0/index.html b/blog/2013-02-27/1-0-0/index.html new file mode 100644 index 0000000..8715cc5 --- /dev/null +++ b/blog/2013-02-27/1-0-0/index.html @@ -0,0 +1,92 @@ + + + + + JSHint 1.0.0 is out + + + + + + + + + + + + + + + + + + + + +
+
+
+

JSHint 1.0.0 is out

+ + + +

JSHint 1.0.0 is now officially released. You can download it from this website +or install via NPM:

+ +
$ npm install jshint
+ +

Also, we have a new website with new up-to-date documentation! Check it out and +let us know what you think. For full 1.0.0 changelog please see our +1.0.0 RC1 announcement.

+
+
+
+ + + + diff --git a/blog/2013-03-05/1-1-0/index.html b/blog/2013-03-05/1-1-0/index.html new file mode 100644 index 0000000..636ba3f --- /dev/null +++ b/blog/2013-03-05/1-1-0/index.html @@ -0,0 +1,108 @@ + + + + + JSHint 1.1.0 is out + + + + + + + + + + + + + + + + + + + + +
+
+
+

JSHint 1.1.0 is out

+ + + +

JSHint 1.1.0 is out! This release contains important bug fixes for 1.0.0 and a +couple of new features.

+ +
  • This version adds a new environment option for PhantomJS: phantom. +(#814)
  • Fixes a bug where JSHint would skip parent directory when looking for +.jshintrc file. (#850)
  • Adds new option gcl to make JSHint style checks compatible with Google +Closure Linter. +(#812 and +#811)
  • Adds a new example .jshintrc file that mirrors defaults from the website.
  • Removes errors about empty input. JSHint will now treat empty files as valid. +(#767)
  • Fixes a bug where code like return "="; would produce a false positive +warning. (#878)
  • Expands on the configurability of unused. This option now accepts the +following values:

    • false: no checking is done.
    • true: checks all variables and parameters, unless unused parameter is +followed by a used one:

      function test(err, val) { + return val; +}

    • "vars": checks only variables but not function parameters.
    • "strict": checks all variables and all function parameters. +(#778)
  • Fixes a bug where \0 in strings would produce a false positive warning.
  • Fixes a bug where unused would generate false positive warnings on ES3 +future reserved words in the ES5 environment.
  • Removes support for all single-line special comments except for // jshint. +(#881)
+ +

I would also like to use this moment to say hi to my friends and family, and +remind everyone that we're running a fundraising campaign on BountySource. All money +donated will be used to pay contributors for fixing bugs and shipping new +features. So if you like JSHint donate today. And if you hate JSHint donate +tomorrow.

+
+
+
+ + + + diff --git a/blog/2013-05-07/2-0-0/index.html b/blog/2013-05-07/2-0-0/index.html new file mode 100644 index 0000000..cfb11d6 --- /dev/null +++ b/blog/2013-05-07/2-0-0/index.html @@ -0,0 +1,143 @@ + + + + + JSHint 2.0.0 + + + + + + + + + + + + + + + + + + + + +
+
+
+

JSHint 2.0.0

+ + + +

WARNING: This release introduces backwards incompatible changes.

+ +

JSHint 2.0.0 is out! This version hits a pretty big milestone for the +project: this is the first JSHint release for which I'm not the +biggest contributor. I personally believe this fact validates JSHint +as a successful open source project. And I'm extremely thankful to +all you who file bug reports and send patches—you're all awesome.

+ +

EcmaScript 5

+ +

The first and foremost: starting with this version JSHint will assume +ES5 as the default environment. Before, JSHint was checking all the +code per ES3 specification with an option to enable ES5 mode. Now ES5 +mode is the default mode and if you want to check your code against the +ES3 specification (useful when developing for super old browsers such as +Internet Explorer 6) you will have to use es3:true.

+ +

Special thanks to Rick Waldron for championing this change.

+ +

Partial support for Mozilla JavaScript extensions and ES6

+ +

Thanks to our newest core contributor, Bernard Pratz, JSHint now has +partial support for Mozilla JavaScript extensions (moz option) and +ES6 (esnext option):

+ +
  • Destructuring assignment
  • const
  • let blocks and expressions
  • Generators and iterators
  • List comprehension
  • Try/catch filters and multiple catch blocks
  • Concise method declaration
  • for ... of loops
  • Fat arrows
+ +

We have more patches in queue that add support for classes and other +nifty ES6 things. Stay tuned!

+ +

CLI

+ +
  • JSHint now looks for .jshintrc in the directory being linted. +(#833)
  • Various cross-platform fixes for our Node CLI module.
  • New public method for the CLI export that allows third-parties +to hook into the file resolution logic. +(#741)
+ +

General

+ +
  • For non-Node system we upgraded to the latest version of Browserify. +This resolves some performance issues we had with Rhino.
  • Added SVG globals to the browser environment.
  • Option smarttabs now ignores mixed tabs and spaces within single- +and multi-line comments.
  • Added a new pragma to unignore a warning:

    /jshint -W096 /

    // All warnings about keys producing unexpected results will + // be ignored here.

    /jshint +W096 /

    // But not here.

  • JSHint now ignores unrecognized JSLint options.

  • Fixed a bug where indent:false was triggering indentation warnings. +(#1035)
  • Fixed a regression bug where unused was not behaving correctly. +(#996)
  • Plus lots and lots of other, smaller bug fixes.
+ +

New rapid release schedule

+ +

And last but not least: starting with this version, I'm switching JSHint +to a more rapid release schedule. This simply means that I will be +publishing new versions of JSHint more often. I will try my best to +follow semver recommendations and ship working +software. But as our license says, no guarantees.

+ +

Thanks to Bernarnd Pratz, Michelle Steigerwalt, Yuya Tanaka, Matthew Flaschen, +Juan Pablo Buritica, Matt Cheely, Steve Mosley, Stephen Sorensen, Rick Waldron, +Hugues Malphettes, Jeff Thompson, xzyfer, Lee Leathers, croensch, Steven Benner, +James Allardice, Sindre Sorhus, Jordan Harband, Stuart Knightley and Kevin Locke +for sending patches!

+
+
+
+ + + + diff --git a/blog/2013-05-08/release-2-0-0/index.html b/blog/2013-05-08/release-2-0-0/index.html new file mode 100644 index 0000000..6fb149b --- /dev/null +++ b/blog/2013-05-08/release-2-0-0/index.html @@ -0,0 +1,143 @@ + + + + + New Release: 2.0.0 + + + + + + + + + + + + + + + + + + + + +
+
+
+

New Release: 2.0.0

+ + + +

WARNING: This release introduces backwards incompatible changes.

+ +

JSHint 2.0.0 is out! This version hits a pretty big milestone for the project: +this is the first JSHint release for which I'm not the biggest contributor. I +personally believe this fact validates JSHint as a successful open source +project. And I'm extremely thankful to all you who file bug reports and send +patches—you're all awesome.

+ +

EcmaScript 5

+ +

The first and foremost: starting with this version JSHint will assume ES5 as +the default environment. Before, JSHint was checking all the code per ES3 +specification with an option to enable ES5 mode. Now ES5 mode is the default +mode and if you want to check your code against the ES3 specification (useful +when developing for super old browsers such as Internet Explorer 6) you will +have to use es3:true.

+ +

Special thanks to Rick Waldron for championing this change.

+ +

Partial support for Mozilla JavaScript extensions and ES6

+ +

Thanks to our newest core contributor, Bernard Pratz, JSHint now has partial +support for Mozilla JavaScript extensions (moz option) and ES6 (esnext +option):

+ +
  • Destructuring assignment
  • const
  • let blocks and expressions
  • Generators and iterators
  • List comprehension
  • Try/catch filters and multiple catch blocks
  • Concise method declaration
  • for ... of loops
  • Fat arrows
+ +

We have more patches in queue that add support for classes and other nifty ES6 +things. Stay tuned!

+ +

CLI

+ +
  • JSHint now looks for .jshintrc in the directory being linted. +(#833)
  • Various cross-platform fixes for our Node CLI module.
  • New public method for the CLI export that allows third-parties to hook into +the file resolution logic. +(#741)
+ +

General

+ +
  • For non-Node system we upgraded to the latest version of Browserify. This +resolves some performance issues we had with Rhino.
  • Added SVG globals to the browser environment.
  • Option smarttabs now ignores mixed tabs and spaces within single- +and multi-line comments.
  • Added a new pragma to unignore a warning:

    /jshint -W096 /

    // All warnings about keys producing unexpected results will + // be ignored here.

    /jshint +W096 /

    // But not here.

  • JSHint now ignores unrecognized JSLint options.

  • Fixed a bug where indent:false was triggering indentation warnings. +(#1035)
  • Fixed a regression bug where unused was not behaving correctly. +(#996)
  • Plus lots and lots of other, smaller bug fixes.
+ +

New rapid release schedule

+ +

And last but not least: starting with this version, I'm switching JSHint to a +more rapid release schedule. This simply means that I will be publishing new +versions of JSHint more often. I will try my best to follow +semver recommendations and ship working software. But as +our license says, no guarantees.

+ +

Thanks to Bernarnd Pratz, Michelle Steigerwalt, Yuya Tanaka, Matthew +Flaschen, Juan Pablo Buritica, Matt Cheely, Steve Mosley, Stephen Sorensen, +Rick Waldron, Hugues Malphettes, Jeff Thompson, xzyfer, Lee Leathers, croensch, +Steven Benner, James Allardice, Sindre Sorhus, Jordan Harband, Stuart Knightley +and Kevin Locke for sending patches!

+
+
+
+ + + + diff --git a/blog/2013-05-20/2-1-0/index.html b/blog/2013-05-20/2-1-0/index.html new file mode 100644 index 0000000..1d7ac78 --- /dev/null +++ b/blog/2013-05-20/2-1-0/index.html @@ -0,0 +1,102 @@ + + + + + JSHint 2.1.0 + + + + + + + + + + + + + + + + + + + + +
+
+
+

JSHint 2.1.0

+ + + +

JSHint 2.1.0 is out. This releases adds support for ES6 class syntax and fixes +some issues with our parser.

+ +
  • Added support for ES6 class syntax. +(#1048)
  • Added support for error code in the Checkstyle reporter. +(#1088)
  • Added support for do statement bodies that are not block +statements. +(#1062)
  • Fixed issues with JSHint not parsing comma expressions correctly. +(#1084)
  • Fixed a bug with W080 no longer pointing to relevant identifiers. +(#1070)
  • Fixed a potential issue with Node 0.10 and Windows. +(#1065)
  • Fixed issues with JSHint not parsing assignments in switch +conditionals. +(#1064)
  • Fixed an issue with esnext and moz modes turning off the +default es5 mode. +(#1068)
+ +

Thanks to usrbincc, James Allardice, Iraê Carvalho, Nick Schonning and jklein +for sending patches!

+
+
+
+ + + + diff --git a/blog/2013-05-21/release-2-1-0/index.html b/blog/2013-05-21/release-2-1-0/index.html new file mode 100644 index 0000000..b5aaa83 --- /dev/null +++ b/blog/2013-05-21/release-2-1-0/index.html @@ -0,0 +1,102 @@ + + + + + New Release: 2.1.0 + + + + + + + + + + + + + + + + + + + + +
+
+
+

New Release: 2.1.0

+ + + +

JSHint 2.1.0 is out. This releases adds support for ES6 class syntax and +fixes some issues with our parser.

+ +
  • Added support for ES6 class syntax. +(#1048)
  • Added support for error code in the Checkstyle reporter. +(#1088)
  • Added support for do statement bodies that are not block +statements. +(#1062)
  • Fixed issues with JSHint not parsing comma expressions correctly. +(#1084)
  • Fixed a bug with W080 no longer pointing to relevant identifiers. +(#1070)
  • Fixed a potential issue with Node 0.10 and Windows. +(#1065)
  • Fixed issues with JSHint not parsing assignments in switch +conditionals. +(#1064)
  • Fixed an issue with esnext and moz modes turning off the +default es5 mode. +(#1068)
+ +

Thanks to usrbincc, James Allardice, Iraê Carvalho, Nick Schonning and +jklein for sending patches!

+
+
+
+ + + + diff --git a/pages/blog/2-1-6.md b/blog/2013-07-28/2-1-6/index.html similarity index 68% rename from pages/blog/2-1-6.md rename to blog/2013-07-28/2-1-6/index.html index 25269fb..7fd8f10 100644 --- a/pages/blog/2-1-6.md +++ b/blog/2013-07-28/2-1-6/index.html @@ -1,25 +1,83 @@ -{ - "template": "blog", - "blog": true, - "title": "JSHint 2.1.6", - "author": "Anton Kovalyov", - "date": "2013-07-28", - "url": "/blog/2013-07-28/2-1-6" -} - -**UPDATE:** We just published another version, 2.1.7, which contains only one bugfix: [#1199](https://github.com/jshint/jshint/pull/1199). - -In this release we added two new arguments to our CLI program: `exclude` which allows -you to exclude directories from linting and `prereq` which allows you to specify a file + + + + + JSHint 2.1.6 + + + + + + + + + + + + + + + + + + + + +
+
+
+

JSHint 2.1.6

+ + + +

UPDATE: We just published another version, 2.1.7, which contains only one bugfix: #1199.

+ +

In this release we added two new arguments to our CLI program: exclude which allows +you to exclude directories from linting and prereq which allows you to specify a file containing declarations of the global variables used throughout your project. In addition to that, we added support for stdin. JSHint now follows a UNIX convention where if a -given file path is a dash (`-`) the the program reads from stdin. +given file path is a dash (-) the the program reads from stdin.

-We also extended our ES6 coverage by adding support for `yield` statements and -`import/export` declarations. JSHint is still **the only** linter that can parse -most ES6 and Mozilla-specific JavaScript code. +

We also extended our ES6 coverage by adding support for yield statements and +import/export declarations. JSHint is still the only linter that can parse +most ES6 and Mozilla-specific JavaScript code.

-For more changes, see the changelog table below. +

For more changes, see the changelog table below.

@@ -48,3 +106,21 @@

Thanks to Terry Roe, Sindre Sorhus, Thomas Boyt, Nikolay S. Frantsev, XhmikosR, Jacob Rask, Kevin Chu, Tim Ruffles, Stephen Mathieson, Lukas Domnick, usrbincc for sending patches!

+ +
+
+
+ + + + diff --git a/blog/2013-07-29/release-2-1-6/index.html b/blog/2013-07-29/release-2-1-6/index.html new file mode 100644 index 0000000..4180ce7 --- /dev/null +++ b/blog/2013-07-29/release-2-1-6/index.html @@ -0,0 +1,149 @@ + + + + + New Release: 2.1.6 + + + + + + + + + + + + + + + + + + + + +
+
+
+

New Release: 2.1.6

+ + + +

UPDATE: We just published another version, 2.1.7, which contains only one +bugfix: #1199.

+ +

In this release we added two new arguments to our CLI program: exclude which +allows you to exclude directories from linting and prereq which allows you to +specify a file containing declarations of the global variables used throughout +your project. In addition to that, we added support for stdin. JSHint now +follows a UNIX convention where if a given file path is a dash (-) the the +program reads from stdin.

+ +

We also extended our ES6 coverage by adding support for yield statements and +import/export declarations. JSHint is still the only linter that can +parse most ES6 and Mozilla-specific JavaScript code.

+ +

For more changes, see the patch summary below.

+ +
  • 004dc61 +Fixed #1178: Changed +'predef' to 'globals' in the example .jshintrc
  • cd69f13 +Fixed #1187: Explicitly +define contents of our NPM package
  • c83caf3 +Fixed #1166: Tweaks to +import/export support
  • 537dcbd +Fixed #1164: Add codes to +errors generated by quit()
  • 6aed7ed +Fixed #1155: Use shelljs +option in make.js
  • 87df213 +Fixed #1153: Moved E037 and +E038 to the warnings section and changed their message.
  • dd060c7 +Fixed #779: Add support for +!pattern in the .jshintignore files
  • 5de09c4 +Fixed #696: Add support for +--exclude arg
  • ee3d598 +Fixed #809: Added short +options to bin/jshint where it made sense
  • b937895 +Fixed #810: Made --reporter +description in -h more straightforward
  • 1c70362 +Fixed #839: Add support for +prereq files
  • 28dae4b +Fixed #741: expose loadConfig +from CLI
  • b39e2ac +Followup #687: +eqnull
  • 90b733b +Followup #687: Use '-' as a +marker for stding
  • 68db0d8 +Fixed #687: Allow input via +stdin
  • 5924b2a +Fixed #1157: Add support for +import/export.
  • 729cfd7 +Fixed #1154: Add MouseEvent +and CustomEvent browser globals
  • 9782fc8 +Fixed #1134: Catch reserved +words in ES3 mode.
  • 87e3e6c +Fixed #1138: Count ternary +and or operators for complexity
  • 66f3e4c +Fixed #1133: Make shelljs +imply node.
  • 79dc812 +Fixed #704: Add config file +support for the Rhino wrappers.
  • 88c862d +Fixed #1109: Parse yield +expressions.
+ +

Thanks to Terry Roe, Sindre Sorhus, Thomas Boyt, Nikolay S. Frantsev, +XhmikosR, Jacob Rask, Kevin Chu, Tim Ruffles, Stephen Mathieson, Lukas Domnick, +usrbincc for sending patches!

+
+
+
+ + + + diff --git a/blog/2013-07-29/stats/index.html b/blog/2013-07-29/stats/index.html new file mode 100644 index 0000000..60ef9cf --- /dev/null +++ b/blog/2013-07-29/stats/index.html @@ -0,0 +1,103 @@ + + + + + Fun little numbers + + + + + + + + + + + + + + + + + + + + +
+
+
+

Fun little numbers

+ + + +

A few months ago I started sending data from this website to Keen.IO, +a small San Francisco-based company specializing in the API for custom analytics. Last +weekend, I finally found some time to look at the numbers.

+ +

In the past six months 169,000 JavaScript programs were linted through this +website (we do not send any data from our our library or CLI progam in any way) and +only 15% of them passed the checks. The average program consisted of 507 +lines of code while the largest program had 101,000 lines in it. This means +someone copied one hunder and one thousand lines of code, pasted it into our +editor and pressed lint. In total, JSHint processed +86,000,000 lines of code through this website exclusively. Only 40% of our users +used default JSHint settings, while 60% of them tweaked the settings in one way or +another.

+ +

As for our NPM module, the NPM website tells us that the package has been downloaded +211,000 times in the last month.

+ +

That's it for now. I will continue to play with Keen.IO and our data to see if it gives +me any additional insight into JSHint and its users.

+
+
+
+ + + + diff --git a/blog/2013-07-31/default-parameters/index.html b/blog/2013-07-31/default-parameters/index.html new file mode 100644 index 0000000..ce132f8 --- /dev/null +++ b/blog/2013-07-31/default-parameters/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/blog/2013-08-02/npm/index.html b/blog/2013-08-02/npm/index.html new file mode 100644 index 0000000..5b705bb --- /dev/null +++ b/blog/2013-08-02/npm/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/blog/2013-08-15/release-2-1-10/index.html b/blog/2013-08-15/release-2-1-10/index.html new file mode 100644 index 0000000..c5cacd3 --- /dev/null +++ b/blog/2013-08-15/release-2-1-10/index.html @@ -0,0 +1,118 @@ + + + + + New Release: 2.1.10 + + + + + + + + + + + + + + + + + + + + +
+
+
+

New Release: 2.1.10

+ + + +

Thanks to Dave Camp JSHint now supports list +comprehensions, a declarative way of transforming a list:

+ +
[ for (i of [ 1, 2, 3 ]) i + 2 ]; // Returns [ 3, 4, 5 ]
+ +

Note: SpiderMonkey currently implements a slightly different syntax for list +comprehensions which is also supported by JSHint.

+ +

Patch summary

+ +
  • ae96e5c +Fixed #1220: Add typed array +option, implied by 'node' option
  • 27bd241 +Fixed #1222: Update +PhantomJS globals to 1.7 API
  • 6c5a085 +Fixed #1216: Support for +array comprehensions using for-of (closed #1095)
  • 83374ad +No issue: Remove /stable/ subdirectories
  • 1a3c47f +Fixed #1174: Fixed a false +positive 'destructuring assignment' warning (closed #1177)
  • 303c535 +Fixed #1183: Fix an issue +with debugger warning pointing to a wrong line in some cases
  • a0b7181 +No issue: Add helper programs to apply and land patches from GitHub
  • 9c2b8dd +Fixed #1194: Don't look for +a config when input is /dev/stdin
  • a17ae9e +Fixed #1189: Support spaces +in /global ... /
  • dcc1251 +Fixed #1197: Make Rhino +wrapper to be more consistent with NPM package.
  • 96ea1a8 +No issue: Split make.js into bin/build and bin/changelog
  • 4ac19fa +No issue: Move JSHint config into package.json
+ +

Thanks to Rob Wu, Ryan Cannon, Dave Camp, Amir Livneh, Josh Hoff, Nikolay +S. Frantsev, Lapo Luchini, Lukas Domnick for sending patches!

+
+
+
+ + + + diff --git a/blog/2013-08-15/release/index.html b/blog/2013-08-15/release/index.html new file mode 100644 index 0000000..4a7c4de --- /dev/null +++ b/blog/2013-08-15/release/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/blog/2015-01-21/release-2-6-0/index.html b/blog/2015-01-21/release-2-6-0/index.html new file mode 100644 index 0000000..88c583d --- /dev/null +++ b/blog/2015-01-21/release-2-6-0/index.html @@ -0,0 +1,96 @@ + + + + + New Release: 2.6.0 + + + + + + + + + + + + + + + + + + + + +
+
+
+

New Release: 2.6.0

+ + + +

Bug Fixes

+ +
  • Add missing globals to browser environment (32f02e0)
  • Allow array, grouping and string form to follow spread operator in function call args. (437655a), closes #2060 #2060
  • Correct bug in enforcement of singleGroups (5fedda6), closes #2064
  • Remove dead code (3b5d94a), closes #883
  • Remove dead code for parameter parsing (a1d5817)
  • Revert unnecessary commit (a70bbda)
+ +

Features

+ +
  • elision option to relax "Extra comma" warnings (cbfc827), closes #2062
  • Add new Jasmine 2.1 globals to "jasmine" option (343c45e), closes #2023
  • Support generators in class body (ee348c3)
+ +

BREAKING CHANGES

+ +
  • In projects which do not enable ES3 mode, it is now an error by default to use elision array elements, +also known as empty array elements (such as [1, , 3, , 5])
+
+
+
+ + + + diff --git a/blog/2015-02-27/release-2-6-1/index.html b/blog/2015-02-27/release-2-6-1/index.html new file mode 100644 index 0000000..aca91e3 --- /dev/null +++ b/blog/2015-02-27/release-2-6-1/index.html @@ -0,0 +1,91 @@ + + + + + New Release: 2.6.1 + + + + + + + + + + + + + + + + + + + + +
+
+
+

New Release: 2.6.1

+ + + +

Bug Fixes

+ +
  • Allow object-literals within template strings (4f08b74), closes #2082
  • Correct behavior of singleGroups (6003c83)
  • Correct token reported by singleGroups (bc857f3)
  • Disambiguate argument (d75ef69)
  • Do not crash on improper use of delete (35df49f)
  • ES6 modules respect undef and unused (438d928)
  • Fix false positives in 'nocomma' option (33612f8)
  • Handle multi-line tokens after return or yield (5c9c7fd), closes #1814 #2142
  • Miss xdescribe/xit/context/xcontext in mocha (8fe6610)
  • Parse nested templates (3da1eaf), closes #2151 #2152
  • Permit "eval" as object key (b5f5d5d)
  • Prevent beginning array from being confused for JSON (813d97a)
  • Refactor doFunction (06b5d40)
  • Remove quotmark linting for NoSubstTemplates (7e80490)
  • Remove tautological condition (f0bff58)
  • remove unused var (e69acfe), closes #2156
  • Simulate class scope for class expr names (ac98a24)
  • Support more cases of ES6 module usage (776ed69), closes #2118 #2143
  • Templates can not be directives (20ff670)
  • Unfollowable path in lexer. (065961a)
+ +

Features

+ +
  • Implement new option futurehostile (da52aa0)
  • parse and lint tagged template literals (4816dbd), closes #2000
+
+
+
+ + + + diff --git a/blog/2015-02-28/release-2-6-2/index.html b/blog/2015-02-28/release-2-6-2/index.html new file mode 100644 index 0000000..fe7b1f1 --- /dev/null +++ b/blog/2015-02-28/release-2-6-2/index.html @@ -0,0 +1,87 @@ + + + + + New Release: 2.6.2 + + + + + + + + + + + + + + + + + + + + +
+
+
+

New Release: 2.6.2

+ + + +

Bug Fixes

+ +
  • Disable futurehostile option by default (3cbd41f)
  • Make let variables in the closure shadow predefs (cfd2e0b)
+
+
+
+ + + + diff --git a/blog/2015-02-28/release-2-6-3/index.html b/blog/2015-02-28/release-2-6-3/index.html new file mode 100644 index 0000000..0905f04 --- /dev/null +++ b/blog/2015-02-28/release-2-6-3/index.html @@ -0,0 +1,87 @@ + + + + + New Release: 2.6.3 + + + + + + + + + + + + + + + + + + + + +
+
+
+

New Release: 2.6.3

+ + + +

Bug Fixes

+ +
  • parse trailing comma in ObjectBindingPattern (7a2b713), closes #2220
+
+
+
+ + + + diff --git a/blog/2015-04-10/release-2-7-0/index.html b/blog/2015-04-10/release-2-7-0/index.html new file mode 100644 index 0000000..a471ad3 --- /dev/null +++ b/blog/2015-04-10/release-2-7-0/index.html @@ -0,0 +1,91 @@ + + + + + New Release: 2.7.0 + + + + + + + + + + + + + + + + + + + + +
+
+
+

New Release: 2.7.0

+ + + +

Bug Fixes

+ +
  • Accept get and set as ID properties (2ad235c)
  • allow trailing comma in ArrayBindingPattern (3477933), closes #2222
  • allow typeof symbol === "symbol" (7f7aac2), closes #2241 #2242
  • Correctly enforce maxparams:0 (011364e)
  • default to empty string in src/cli.js loadIgnores (0eeba14)
  • disallow 'lone' rest operator in identifier() (dd08f85), closes #2222
  • emit I003 more carefully and less annoyingly (757fb73), closes #2251
  • export all names for var/let/const declarations (3ce1267), closes #2248 #2253 #2252
  • Incorrect 'Unclosed string' when the closing quote is the first character after a newline (b804e65), closes #1532 #1532 #1319
  • predefine HTMLTemplateElement in browser (231557a), closes #2246
  • Prevent incorrect warnings for relations (64f85f3)
  • Relax restrictions on singleGroups (896bf82)
  • templates are operands, not operators (162dee6), closes #2223 #2224
+ +

Features

+ +
  • add varstmt enforcement option to disallow use of VariableStatements (59396f7), closes #1549
+
+
+
+ + + + diff --git a/blog/2015-05-31/release-2-8-0/index.html b/blog/2015-05-31/release-2-8-0/index.html new file mode 100644 index 0000000..a3de032 --- /dev/null +++ b/blog/2015-05-31/release-2-8-0/index.html @@ -0,0 +1,91 @@ + + + + + New Release: 2.8.0 + + + + + + + + + + + + + + + + + + + + +
+
+
+

New Release: 2.8.0

+ + + +

Bug Fixes

+ +
  • add the "fetch" global for "browser" environment (b3b41c8), closes #2355
  • Allow lexer to communicate completion (a093f78)
  • Distinguish between directive and mode (51059bd)
  • Don't throw "Duplicate class method" with computed method names (ab12dfb), closes #2350
  • Ignore unused arrow-function parameters if unused: vars (2ea9cb0), closes #2345
  • Move helper methods to state object (678da76)
  • parse const declarations in ForIn/Of loops (2b673d9), closes #2334 #2335
  • Parse semicolons in class bodies (58c8e64)
  • Prevent regression in enforceall (6afcde4)
  • Relax singleGroups restrictions: arrow fns (4a4f522)
  • Relax singleGroups restrictions: IIFEs (9f55160)
  • Reset generator flag for each method definition (2444a04), closes #2388 #2389
+ +

Features

+ +
  • Implement module option (290280c)
  • support destructuring in ForIn/Of loops, lint bad ForIn/Of LHS (c0edd9f), closes #2341
+
+
+
+ + + + diff --git a/blog/2015-09-03/release-2-9-0/index.html b/blog/2015-09-03/release-2-9-0/index.html new file mode 100644 index 0000000..8029765 --- /dev/null +++ b/blog/2015-09-03/release-2-9-0/index.html @@ -0,0 +1,112 @@ + + + + + New Release: 2.9.0 + + + + + + + + + + + + + + + + + + + + +
+
+
+

New Release: 2.9.0

+ + + +

Note This release was revoked shortly following its publication. Please +refer to the release notes for version 2.9.1 for more information (found in the +project's CHANGELOG.md file and on the project's website).

+ +

This release was a long time in the making, but it may not be the most exciting +version we've published. Most of the changes are internal refactorings that +were necessary to properly fix bugs. And fix bugs we did! Special thanks go to +Luke Page, the newest addition to the JSHint team. Luke is a maintainer of the +Less CSS project, and he introduced himself to use by +overhauling JSHint's variable tracking logic.

+ +

JSHint 3.0 is closer than ever. We're excited for the opportunity to break a +few things in order to make real strides forward. In fact, the hardest part +will be limiting ourselves (we don't want to make migrating to the new +version onerous). If you have any ideas along these lines, please submit them +on the project's issue tracker. +We'll mark them with the label "Breaking +Change", and as we +decide what's definitely "in" for 3.0, we'll add them to the "v3.0.0" +milestone.

+ +

Bug Fixes

+ +
  • Add HTMLCollection to browser environment. (e92d375), closes #2443
  • Add window.performance to browser vars (3ff1b05), closes #2461
  • Allow __proto__ when using ES6 (06b5764), closes #2371
  • Allow binary and octal numbers, and templates when using inline esnext (b5ba7d6), closes #2519
  • Allow default values in destructuring. (04ace9a), closes #1941
  • Allow destructuring in catch blocks parameter (759644c), closes #2526
  • Allow latedef in the initialiser of variable (18f8775), closes #2628
  • Allow line breaking after yield if asi: true (728c84b), closes #2530
  • Allow non-identifier PropertyNames in object destructuring. (aa8a023), closes #2467
  • Allow object destructuring assignment (ae48966), closes #2269
  • Allow semicolon as string value in JSON (ab73e01)
  • block scope vars dont redefine in blocks (9e74025), closes #2438
  • Catch blocks are no longer functions (8a864f3), closes #2510
  • Change imported variables to be constants (94a6779), closes #2428
  • Classes are not hoisted (87378cc), closes #1934
  • Correct exported AssignmentExpressions (282b40e)
  • Correctly parse empty destructuring (97c188b), closes #2513
  • Correctly parse exported generators (0604816), closes #2472
  • Declare func as a property of state (3be8d36)
  • default params can't reference future arg (bc2741c), closes #2422
  • Define "build" module (2f98f91)
  • Define npm scripts for each test suite (5c33ded)
  • Do not accept empty values for directives (a5bfefb)
  • Do not crash if the forin check is block (d1cbe84), closes #1920
  • Do not mark ignore directives as special (f14c262)
  • Do not parse arrays which contain for as array comprehensions. (d70876c), closes #1413
  • Don't crash on uncomplete typeof expression (a32cf50), closes #2506
  • Don't warn when Array() is used without 'new'. (5f88aa7), closes #1987
  • Dont crash when testing x == keyword if eqnull is on (6afd373), closes #2587
  • Dont warn twice in var redeclaration (e32e17b)
  • handle no 'home' environment variables (946af3e)
  • Honor ignore directive more consistently (0971608)
  • Ignore directive should ignore max line length for comments (f2f871a), closes #1575
  • Immediately-invoked arrow funcs' param doesn't need parentheses (d261071), closes #2351
  • Improve support for __proto__ identifier (925a983)
  • It is not un-necessary to assign undefined in a loop (e8ce9bf), closes #1191
  • labeled break and continue semantics (da66f70)
  • Labels shadowing within a function is a syntax error (124e00f), closes #2419
  • Load JSHint from package root (92acdd1)
  • Make strict: func have precedence over env options. (d138db8)
  • Param destructuring should not effect max params (9d021ee), closes #2183
  • Params cannot always have the same name (9f2b64c), closes #2492
  • Prevent regressions in bug fix (477d3ad)
  • Regular args can come after args with default (f2a59f1), closes #1779
  • Relax restriction on module option (56c19a5)
  • Remove bad error E048 in for loop init (a8fc16b), closes #1862
  • Remove module import declaration (1749ac0)
  • Report an error when a necessary semicolon is missing (45d8e3e), closes #1327
  • report line numbers of destructured params (7d25451), closes #2494
  • Report loopfunc for all function types (4d4cfcd), closes #2153
  • singleGroups: Allow grouping for integers (8c265ca)
  • Support new.target (2fbf621)
  • The __iterator__ property is deprecated. (7780613)
  • Unify assign operation checks. (06eb1d2), closes #2589
  • use of params is not capturing loopfunc (827e335)
  • Warn about using var inside for (...) when varstmt: true (f1ab638), closes #2627
+ +

Features

+ + +
+
+
+ + + + diff --git a/blog/2015-11-12/release-2-9-1-rc1/index.html b/blog/2015-11-12/release-2-9-1-rc1/index.html new file mode 100644 index 0000000..92ec8b4 --- /dev/null +++ b/blog/2015-11-12/release-2-9-1-rc1/index.html @@ -0,0 +1,101 @@ + + + + + New Release: 2.9.1-rc1 + + + + + + + + + + + + + + + + + + + + +
+
+
+

New Release: 2.9.1-rc1

+ + + +

Version 2.9.0 was revoked shortly after its release due to a number of +regressions. Although the underlying issues have been resolved, we are +sensitive to the possibility that there may be still more; as mentioned in +2.9.0's release notes, the variable tracking system saw a significant +refactoring.

+ +

In an effort to minimize friction with a new version, we're publishing a +release candidate and requesting feedback from early adopters. Please give it a +try in your projects and let us know about any surprising behavior!

+ +

Bug Fixes

+ +
  • latedef shouldn't warn when marking a var as exported (c630994), closes #2662
  • Add File and FileList to browser global variables (7f2a729), closes #2690
  • Allow comments and new lines after / falls through / (3b1c925), closes #2652 #1660
  • Allow let and const to be in a block outside of a block (84a9145), closes #2685
  • Always warn about missing "use strict" directive (e85c2a1), closes #2668
  • Disallow incompatible option values (72ba5ad)
  • Do not enable newcap within strict mode (acaf3f7)
  • Don't throw W080 when the initializer starts with undefined (0d87919), closes #2699
  • Don't warn that an exported function is used before it is defined. (d0433d2), closes #2658
  • Enforce Identifier restrictions lazily (ceca549)
  • Global "use strict" regressions (04b43d2), closes #2657 #2661
  • Support property assignment when destructure assigning (b6df1f2), closes #2659 #2660
  • Throw W119 instead of "Unexpected '`'" when using templates in ES5 mode. (87064e8)
+ +

Features

+ +
  • Support QUnit's global notOk (73ac9b8)
+
+
+
+ + + + diff --git a/blog/2015-12-22/release-2-9-1-rc2/index.html b/blog/2015-12-22/release-2-9-1-rc2/index.html new file mode 100644 index 0000000..13ad96e --- /dev/null +++ b/blog/2015-12-22/release-2-9-1-rc2/index.html @@ -0,0 +1,87 @@ + + + + + New Release: 2.9.1-rc2 + + + + + + + + + + + + + + + + + + + + +
+
+
+

New Release: 2.9.1-rc2

+ + + +

Bug Fixes

+ +
  • Abort in the presence of invalid config (767c47d)
  • Allow ignoring W020 and W021 (46db923), closes #2761
  • Correct unused for function-scoped vars (91fa9fc)
  • Disallow ambiguous configuration values (eb54a4c)
  • Do not disable ES6 when moz is set (97dfd90)
  • Don't throw '(NaN% scanned)' (903b698)
+
+
+
+ + + + diff --git a/blog/2016-01-12/release-2-9-1-rc3/index.html b/blog/2016-01-12/release-2-9-1-rc3/index.html new file mode 100644 index 0000000..3d93921 --- /dev/null +++ b/blog/2016-01-12/release-2-9-1-rc3/index.html @@ -0,0 +1,87 @@ + + + + + New Release: 2.9.1-rc3 + + + + + + + + + + + + + + + + + + + + +
+
+
+

New Release: 2.9.1-rc3

+ + + +

Bug Fixes

+ +
  • Do not require global USD for any envs (3fa9ece)
+
+
+
+ + + + diff --git a/blog/2016-01-14/release-2-9-1/index.html b/blog/2016-01-14/release-2-9-1/index.html new file mode 100644 index 0000000..801e6c1 --- /dev/null +++ b/blog/2016-01-14/release-2-9-1/index.html @@ -0,0 +1,93 @@ + + + + + New Release: 2.9.1 + + + + + + + + + + + + + + + + + + + + +
+
+
+

New Release: 2.9.1

+ + + +

Following the revocation of version 2.9.0, we observed an extended "release +candidate" phase where we encouraged users to vet JSHint for undesirable +changes in behavior. During that time, we identified and resolved a number of +such regressions. This release comprises all changes from the release candidate +phase along with the improvements initially released as version 2.9.0. This +release does not itself contain any changes to the codebase. If you are +upgrading from version 2.8.0 or earlier, please refer to the +previously-published release notes for details on bug fixes and features--these +can be found in the project's CHANGELOG.md file and on the project's website.

+
+
+
+ + + + diff --git a/blog/2016-04-19/release-2-9-2/index.html b/blog/2016-04-19/release-2-9-2/index.html new file mode 100644 index 0000000..5c80fee --- /dev/null +++ b/blog/2016-04-19/release-2-9-2/index.html @@ -0,0 +1,91 @@ + + + + + New Release: 2.9.2 + + + + + + + + + + + + + + + + + + + + +
+
+
+

New Release: 2.9.2

+ + + +

This release contains a number of bug fixes. As always, we thank everyone who +reported issues and submitted patches; those contributions are essential to the +continuing improvement of the project. We hope you'll keep it up!

+ +

Bug Fixes

+ +
  • (cli - extract) lines can end with "\r\n", not "\n\r" (93818f3), closes #2825
  • Account for implied closures (c3b4d63)
  • Add CompositionEvent to browser globals (56515cf)
  • Allow destructuring in setter parameter (97d0ac1)
  • Allow parentheses around object destructuring assignment. (7a0bd70), closes #2775
  • Allow regex inside template literal (5dd9c90), closes #2791
  • Allow regexp literal after 'instanceof' (caa30e6), closes #2773
  • Correct CLI's indentation offset logic (47daf76), closes #2778
  • Do not crash on invalid input (2e0026f)
  • Do not fail on valid configurations (2fb3c24)
  • Don't throw E056 for vars used in two functions (fd91d4a), closes #2838
  • Emit correct token value from "module" API (4a43fb9)
  • Expand forms accepted in dstr. assignment (8bbd537)
  • Improve binding power for tagged templates (9cf2ff0)
  • Improve reporting of "Bad assignment." (08df19e)
  • Make the 'freeze' option less strict (b76447c), closes #1600
  • Report "Bad assignment." in destructuring (fe559ed)
  • Report character position for camelcase errors (480252a), closes #2845
  • Reserve await keyword in ES6 module code (b1c8d5b)
+
+
+
+ + + + diff --git a/blog/2016-08-18/release-2-9-3/index.html b/blog/2016-08-18/release-2-9-3/index.html new file mode 100644 index 0000000..a286c59 --- /dev/null +++ b/blog/2016-08-18/release-2-9-3/index.html @@ -0,0 +1,91 @@ + + + + + New Release: 2.9.3 + + + + + + + + + + + + + + + + + + + + +
+
+
+

New Release: 2.9.3

+ + + +

Bug Fixes

+ +
  • Add TypedArray globals for ES2015 (ee0acab)
  • Allow Expression within for-in head (56c95d0)
  • Avoid crash when peeking past end of prog (#2937) (330d429)
  • Correct behavior of singleGroups (#2951) (97fefb7)
  • Correct interpretation of ASI (#2977) (3ef7a03)
  • Correctly recognize asi after directives (039ee2e), closes #2714
  • Disallow Import declarations below top lvl (d800e44)
  • Support y RegExp flag in ES2015 code (#2999) (a801433)
  • Support semicolons within arrow fn params (#3003) (179a9d6)
+ +

Features

+ +
  • Error for literals on rhs of instanceof (e3e745b), closes #2777
+
+
+
+ + + + diff --git a/blog/2016-10-20/release-2-9-4/index.html b/blog/2016-10-20/release-2-9-4/index.html new file mode 100644 index 0000000..e533856 --- /dev/null +++ b/blog/2016-10-20/release-2-9-4/index.html @@ -0,0 +1,87 @@ + + + + + New Release: 2.9.4 + + + + + + + + + + + + + + + + + + + + +
+
+
+

New Release: 2.9.4

+ + + +

Bug Fixes

+ +
  • Allow RegExp literal as yield operand (#3011) (b646aea)
  • Allow W100 to be ignored during lookahead (a2b3881), closes #3013
  • Avoid crashing on invalid input (#3046) (bec152c)
  • Correct interpretation of ASI (#3045) (9803e11)
  • Do not duplicate reported warnings/errors (dc4a4fe)
  • Enforce TDZ within initializer of lexical declaration 8e9d406), closes #2637
  • Enforce TDZ within class heritage definition 8e9d406)
  • Enforce TDZ within for in/of head 8e9d406), closes #2693
  • Offset line no.s of errors from eval code (2a31c94)
  • Remove null value from errors array (#3049) (f7eb3d7)
  • Report error for offending token value (3b06d01)
+
+
+
+ + + + diff --git a/blog/better-npm-integration/index.html b/blog/better-npm-integration/index.html new file mode 100644 index 0000000..01ae1fc --- /dev/null +++ b/blog/better-npm-integration/index.html @@ -0,0 +1,90 @@ + + + + + Better integration with NPM + + + + + + + + + + + + + + + + + + + + +
+
+
+

Better integration with NPM

+ + + +

If you're working on an NPM package you don't need to have a .jshintrc +file anymore. Just put your JSHint options into your package.json file +as a property named jshintConfig and you're all set! The format +is exactly the same as .jshintrc.

+ +

Example: package.json for JSHint itself.

+
+
+
+ + + + diff --git a/blog/es6-default-parameters/index.html b/blog/es6-default-parameters/index.html new file mode 100644 index 0000000..0008893 --- /dev/null +++ b/blog/es6-default-parameters/index.html @@ -0,0 +1,95 @@ + + + + + ES6 default parameters + + + + + + + + + + + + + + + + + + + + +
+
+
+

ES6 default parameters

+ + + +

Yesterday, I decided to post a bounty on a feature request to add support +for ES6 parameter default values. +I put $50 and a few minutes later the bounty was increased to $150. Then I sent out this tweet and +went to grab some food:

+ + + + +

One hour later an incredible Thomas Boyt +posted his solution which I reviewed, landed and published today as JSHint 2.1.8. +This means that JSHint now officially supports default parameters!

+
+
+
+ + + + diff --git a/blog/hello/index.html b/blog/hello/index.html new file mode 100644 index 0000000..d405b8d --- /dev/null +++ b/blog/hello/index.html @@ -0,0 +1,90 @@ + + + + + Hello + + + + + + + + + + + + + + + + + + + + +
+
+
+

Hello

+ + + +

After almost a year into development we decided that it's time to +make more frequent stable releases and keep a blog.

+ +

Here are some links from the past:

+ + +
+
+
+ + + + diff --git a/blog/index.html b/blog/index.html new file mode 100644 index 0000000..07d90bd --- /dev/null +++ b/blog/index.html @@ -0,0 +1,371 @@ + + + + + JSHint Blog + + + + + + + + + + + + + + + + + + + + +
+
+
+

JSHint Blog

+ +

The Official JSHint Blog: announcements, discussions, and more. + (RSS)

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Oct 20th, 2016
Aug 18th, 2016
Apr 19th, 2016
Jan 14th, 2016
Jan 12th, 2016
Dec 22nd, 2015
Nov 12th, 2015
Sep 3rd, 2015
Jul 7th, 2015
May 31st, 2015
Apr 10th, 2015
Feb 28th, 2015
Feb 28th, 2015
Feb 27th, 2015
Jan 21st, 2015
Dec 27th, 2013
Oct 21st, 2013
Oct 8th, 2013
Oct 1st, 2013
Aug 15th, 2013
Aug 15th, 2013
Aug 2nd, 2013
Jul 31st, 2013
Jul 29th, 2013
Jul 29th, 2013
Jul 28th, 2013
May 21st, 2013
May 20th, 2013
May 8th, 2013
May 7th, 2013
Mar 5th, 2013
Feb 27th, 2013
Jan 18th, 2013
Jan 18th, 2013
Jan 2nd, 2013
Jan 1st, 2013
Dec 31st, 2012
Dec 31st, 2012
Dec 29th, 2012
Oct 24th, 2012
Sep 25th, 2012
Sep 3rd, 2012
Aug 20th, 2012
Aug 5th, 2012
Jul 26th, 2012
May 1st, 2012
Feb 13th, 2012
Jan 19th, 2012
Jan 8th, 2012
Dec 30th, 2011
Dec 23rd, 2011
Dec 20th, 2011
+ +
+ +
+ + + +
+
+
+ + + + diff --git a/pages/blog/2-1-10.md b/blog/jshint-2-1-10/index.html similarity index 56% rename from pages/blog/2-1-10.md rename to blog/jshint-2-1-10/index.html index 5027438..a8d4e9b 100644 --- a/pages/blog/2-1-10.md +++ b/blog/jshint-2-1-10/index.html @@ -1,22 +1,79 @@ -{ - "template": "blog", - "blog": true, - "title": "JSHint 2.1.10", - "author": "Anton Kovalyov", - "date": "2013-08-15", - "url": "/blog/jshint-2-1-10", - "altUrl": "/blog/2013-08-15/release" -} + -Thanks to [Dave Camp](https://twitter.com/campd) JSHint now supports list comprehensions, a declarative way of -transforming a list: + + + JSHint 2.1.10 - [ for (i of [ 1, 2, 3 ]) i + 2 ]; // Returns [ 3, 4, 5 ] + + + -Note: SpiderMonkey currently implements a slightly different syntax for list comprehensions which is also supported -by JSHint. + -### Changelog + + + + + + + + + + + + + +
+
+
+

JSHint 2.1.10

+ + + +

Thanks to Dave Camp JSHint now supports list comprehensions, a declarative way of +transforming a list:

+ +
[ for (i of [ 1, 2, 3 ]) i + 2 ]; // Returns [ 3, 4, 5 ]
+ +

Note: SpiderMonkey currently implements a slightly different syntax for list comprehensions which is also supported +by JSHint.

+ +

Changelog

@@ -35,3 +92,21 @@

Thanks to Rob Wu, Ryan Cannon, Dave Camp, Amir Livneh, Josh Hoff, Nikolay S. Frantsev, Lapo Luchini, Lukas Domnick for sending patches!

+ +
+
+
+ + + + diff --git a/blog/jshint-3-plans/index.html b/blog/jshint-3-plans/index.html new file mode 100644 index 0000000..597b320 --- /dev/null +++ b/blog/jshint-3-plans/index.html @@ -0,0 +1,119 @@ + + + + + JSHint 3 plans + + + + + + + + + + + + + + + + + + + + +
+
+
+

JSHint 3 plans

+ + + +

A few weeks ago we shipped the new JSHint website and it seemed like +people liked it! In this blog post, I'd like to share my plans for the +next major release of JSHint.

+ +

The next release will be a backwards incompatible release in which I plan +to clean up and simplify our core package. Here are my current goals +for that release:

+ +
  • Remove all style-related options and warnings. If it makes sense they +should be moved into optional plugins.
  • Simplify options. All options should enable some sort of a warning with +some of them enabled by default.
  • Build a foundation for plugins by exposing AST and adding additional +hooks.
  • Redesign the API. Since it is a backwards incompatible release, I +think it could be a great opportunity to change our API from JSHINT(...) && +JSHINT.data() to something better.
+ +

As you can guess from my goals, I don't consider JSHint to be a style tool. +I strongly believe that there's a market for a good JavaScript style and +formatting tool, but I don't think it should be JSHint's job.

+ +

JSHint is really good at giving programmers insight into their code +and I plan to iterate and improve that side of it. For example, +wouldn't it be nice if JSHint could not only warn about undefined variables +but also detect if that undefined variable is the result of a typo?

+ +

Today many editors, IDEs and teaching services use JSHint to do static +analysis. The next major release will be about making their life easier. +If you're using JSHint within your product or organization and have feedback +on how you'd like JSHint to be improved, now is a perfect time to +send me an email.

+ +

Don't panic

+ +

This doesn't mean there won't be any updates to the current stable branch (2.x) +of JSHint until 3 is ready. There will be changes, bug fixes and new features +published soon.

+
+
+
+ + + + diff --git a/blog/new-in-jshint-dec-2013/index.html b/blog/new-in-jshint-dec-2013/index.html new file mode 100644 index 0000000..8a4c362 --- /dev/null +++ b/blog/new-in-jshint-dec-2013/index.html @@ -0,0 +1,167 @@ + + + + + What's new in JSHint (December, 2013) + + + + + + + + + + + + + + + + + + + + +
+
+
+

What's new in JSHint (December, 2013)

+ + + +

Our latest release, 2.4.0, +was mostly a bug fix release. We fixed a lot of parsing bugs. Among them were +quite a few serious ES6-related bugs which were blocking some people and +companies from using JSHint on their ES6 codebases. Since ES6 is still in-progress, +a moving target, there might be some minor inconsistencies but overall, +if you're using more-or-less stable parts of ES6, you can use JSHint to lint +your forward-thinking code.

+ +

We also fixed a couple of bugs that were resulting in JSHint crashing +when trying to parse invalid code. If your code is syntactically +broken beyond all hope JSHint might generate false-positive warnings +and then give up but it should never crash.

+ +

Features

+ +

Thanks to @BenoitZugmeyer we added +a new flag to the JSHint CLI program, --extract, that allows JSHint +to lint JavaScript within HTML files.

+ +
tmp ☭ cat test.html
+<html>
+  <head>
+    <title>Hello, World!</title>
+    <script>
+      function hello() {
+        return "Hello, World!";
+      }
+    </script>
+  </head>
+  <body>
+    <h1>Hello, World!</h1>
+    <script>
+      console.log(hello())
+    </script>
+  </body>
+</html>
+
+tmp ☭ jshint --extract=auto test.html
+test.html: line 13, col 27, Missing semicolon.
+
+1 error
+ +

Another new flag is --exclude-path which allows you to provide your +own .jshintignore file. Or you can point it to the .gitignore file and +kill two birds with one stone: exclude files both from your version control +system and JSHint.

+ +

As always, the detailed list of changes is on GitHub: JSHint 2.4.0 is released.

+ +

JSHint 3

+ +

Our next major release is shaping up nicely. I removed a lot of old code, +split jshint.js into smaller pieces and changed its API. New API doesn't +mutate any global object, it simply takes your arguments and returns the +resulting object:

+ +
var jshint = require("jshint");
+var report = jshint.run(source, options, globals);
+
+report.data.errors.forEach(function (err) {
+  console.log(err.line, err.message);
+});
+ +

Almost all bug fixes and new features from 2.4.0 were backported into the +3.x tree so the codebase is pretty well synced at this point.

+ +

Ramblings

+ +

On the development side, I'm spending a lot of time trying to reduce the +internal state of JSHint. This means a lot of decoupling, rewriting and +re-architecting but the codebase is already looking much better.

+ +

I still haven't decided if I want to make JSHint's internal parser +to generate an AST or if I want to take a shortcut and use Acorn to do +the work for me. (This doesn't mean throwing away JSHint's +parser. We can't do that because no other parser can parse incomplete +files like JSHint and no other parser supports ES6 and Mozilla JavaScript +extensions.) Given that Acorn doesn't support ES6 syntax yet and will +probably never support Mozilla JavaScript extensions, in some cases JSHint +will not be able to return an AST. But for majority of users it should be +fine. Or, maybe, I can do Acorn as a stop-gap solution while I'm patching +JSHint to generate its own tree. Since everyone uses Mozilla Parser API +it should be easy enought to do a drop-in replacement.

+
+
+
+ + + + diff --git a/blog/new-in-jshint-oct-2013/index.html b/blog/new-in-jshint-oct-2013/index.html new file mode 100644 index 0000000..0750641 --- /dev/null +++ b/blog/new-in-jshint-oct-2013/index.html @@ -0,0 +1,138 @@ + + + + + What's new in JSHint (October, 2013) + + + + + + + + + + + + + + + + + + + + +
+
+
+

What's new in JSHint (October, 2013)

+ + + +

We shipped a couple of exciting new features in October. Here's a short +write-up about some of them.

+ +

Ignore directive

+ +

Thanks to Daniel Miladinov, JSHint +can now ignore blocks of code which makes it easier to use JSHint with +JavaScript language extensions such as Facebook React.

+ +
// Code here will be linted with JSHint.
+/* jshint ignore:start */
+// Code here will be linted with ignored by JSHint.
+/* jshint ignore:end */
+ +

All code in between ignore:start and ignore:end won't be +passed to JSHint at all. Additionally, you can ignore a single +line with a trailing comment:

+ +
ignoreThis(); // jshint ignore:line
+ +

Checks for the typeof operator

+ +

Thanks to Oleg Grenrus, JSHint can now +check the use of a typeof operator when its result is compared +to a string. This operator has only a limited set of possible return +values (mdn). +If you try to compare it with an invalid value, JSHint will produce +a warning informing you about the issue. You can disable this check +with a notypeof option.

+ +
// 'fuction' instead of 'function'
+if (typeof a == "fuction") { // Warning: Invalid typeof value 'fuction'
+  /* ... */
+}
+ +

New option: freeze

+ +

Thanks to Caitlin Potter, there's a new +option—freeze—that prohibits the modification of native objects +such as Array, Number, Date, etc. It's generally a bad idea to modify +these objects unless you're absolutely sure you know what you're doing.

+ +
/* jshint freeze:true */
+Array.prototype.count = function (value) { return 4; };
+// -> Warning: Extending prototype of native object: 'Array'.
+ +

This option is still under development. Do you have suggestions +on how we can improve it? Tell us here.

+ +

Changesets

+ +

We now use GitHub releases to host our changesets:

+ + +
+
+
+ + + + diff --git a/blog/new-lang-features/index.html b/blog/new-lang-features/index.html new file mode 100644 index 0000000..ca61f7d --- /dev/null +++ b/blog/new-lang-features/index.html @@ -0,0 +1,255 @@ + + + + + A Formal Commitment to New Language Features + + + + + + + + + + + + + + + + + + + + +
+
+
+

A Formal Commitment to New Language Features

+ + + +

In recent months, JSHint has been receiving requests to support proposed +JavaScript language features like +async/await, method +decorators, and class +property declarations +[1]. The JSHint team has turned down each request, even after the +release of ES2015. This has +not been easy; as open source project maintainers, nothing gives us more +pleasure than to write code in benefit of our users. We've tried to explain our +motivations in an ad-hoc way, but it's always come off as a bit haphazard. We'd +like to take some time to more thoroughly describe our thought process.

+ +

The long and short of it is: JSHint will require all language extension +proposals to be at "Stage 2" of TC-39's standardization +process +before parsing and linting them.

+ +

Why so defensive?

+ +

Projects like Traceur and +Babel have become very popular through progressive +implementation of the latest features and proposals. It's fair to question why +JSHint should be any different.

+ +

First off, it's difficult for the project maintainers. This is not really a +defensible motivation; we only offer it in the interest of full disclosure. +Over the years, JSHint has grown from JSLint thanks to +the efforts of hundreds of contributors. This has been key to its success, but +it has also contributed to a fair amount of technical debt. Extending the +parser requires a fair amount of study, and even then, it isn't always clear +how to do this cleanly.

+ +

The project has tried to be progressive about new syntax in the past +[2], and this has often contributed to technical debt. For instance, +JSHint continues to +(grudgingly) +maintain a moz option for Mozilla-specific +extensions, +and the current esnext option includes non-standard array comprehensions. (By +the way: now that ES2015 is released, that name describes a non-existent +specification draft.)

+ +

A plugin system is one possible +way to address this, but that will require a large effort involving careful +design, spanning refactoring, and a long-term commitment to implementation +details.

+ +

More importantly, it's hazardous for developers. Inconsistencies within +toolchains will gate developers on the lowest common denominator. Imagine the +day that your transpiler supports draft 17 but JSHint has moved to draft 18. +Even if you're not struggling with coordination issues between parsers, the +release cycle for a "progressive" parser would leave most application +developers behind. Projects would frequently rely on outdated release channels +that no longer received bug fixes or new features.

+ +

JSHint was born out of a reluctance to make decisions on behalf of the +user, +so while we think the above considerations should be made clear to JSHint's +users, we haven't made this decision based on them.

+ +

We also believe it's harmful for the ecosystem. Empowering developers to +write non-standard code can have long-term effects on the open source +ecosystem. Code has a tendency to live longer than we expect, but it isn't +always maintained throughout its lifetime. We all look forward to the day that +features like method decorators are standard and widely-supported. Prior to +that, it's important to remember that the code we write with experimental +language features is itself non-standard. It will be frustrating if, in 2 +years, you are reviewing older code that seems to use "standard" function +decorators but that in reality depends on the syntax and semantics of "revision +12" of the function decorator proposal. The differences may be subtle, and you +will be forced to research the behavior of this not-quite-JavaScript before you +can contribute to the project.

+ +

Finally, it's unhealthy for the language. TC39 does not operate from an +ivory tower. They recognize practical considerations of patterns in existing +code. Look no further than Annex +B +for proof of that. Sometimes, that is a good thing. The Promises/A+ +spec offered a clear way forward when Promises +were first considered for inclusion in ES2015. Sometimes, this is a bad thing. +It's the reason why we expect +Array.prototype.includes +instead of +Array.prototype.contains. +The proliferation of production code can have a solidifying +effect +on new features. To the extent that JSHint is a channel through which new +JavaScript flows (a minuscule one to be sure), we want to cooperate with the +design process.

+ +

So why stage 2?

+ +

Stage 2 seems specifically designed for our position in the ecosystem.

+ +

It's not too early. Features in this stage have a formal definition (so we have +a consistent and complete set of instructions to build from). These features +are also relatively stable, so JSHint has a chance to keep up with the latest +draft modifications.

+ +

It's also not too late. The design process can still benefit from the +experience of developers applying a given pattern to their code. The process +document defines "incremental" changes expected for Stage 2 proposals, and only +recommends "experimental" implementations. You might say, "these features seem +stable enough", but +the truth is, JSHint was dealing with non-trivial modifications to ES2015 from +the moment we implemented them until as late as May of this year [3]. +So it's worth noting that JSHint is still taking some risk here.

+ +

We think there's tremendous value in experimentation at earlier stages in the +process. We also feel that research should be conducted in non-production +settings in order to avoid the more fundamental problems discussed above. +Early-stage experiments have less to gain from automated code analysis both +because of their limited scope and because their syntax is already verified by +a "transpiler". In these contexts, linting has much more limited relevance.

+ +

Moving forward

+ +

Here's the practical effect of all that talk:

+ +
  • JSHint 3 will not expose an esnext option; it will instead support +esversion: 6.
  • JSHint will continue to support the moz option, and it will be the only +setting that enables array comprehension parsing.
  • JSHint will not expose an esversion: 7 option until that specification is +finalized by ECMA.
  • JSHint will support for stage-2-and-above proposals under the experimental +configuration namespace. These features will be clearly documented as subject +to breaking changes between major releases.
+ +

This policy means denying first-class support for non-standard and early +proposal features. JSHint will continue to support ignore directives as a +coarse-grained mechanism for operating on non-standard and early-proposal +features, but we know other linting tools go much farther than +that. We're motivated by our +responsibility to developers but also to the open source ecosystem and to the +standards process itself. We hope JSHint's usership continues to enjoy the tool +because they share these same values.

+ +
+ + +[1] Requests for proposed language features: + + + + + + +[2] Introduction of ES6 features + + + + + + +[3] Issues involving changes to the spec: + + + + + +
+
+
+ + + + diff --git a/blog/new-site/index.html b/blog/new-site/index.html new file mode 100644 index 0000000..0c10758 --- /dev/null +++ b/blog/new-site/index.html @@ -0,0 +1,105 @@ + + + + + New JSHint website + + + + + + + + + + + + + + + + + + + + +
+
+
+

New JSHint website

+ + + +

For the last couple of weeks I've been working on a new homepage for JSHint +and today I'm proud to announce the new jshint.com!

+ +

JSHint Website

+ +

I decided to change the website to show the direction where I'm taking JSHint +and where I'd like to see other developer tools go in the near future.

+ +

If you go to the front-page right now, you'll notice +that it doesn't have a Lint button anymore. Once you start typing your +code, JSHint will always be working in the background, providing you with +valuable data about your code. This data consists of not only warnings but +also of different metrics such as the cyclomatic complexity. These metrics +help you step back and look at the overall health of your codebase.

+ +

I think that such instant feedback from the tools that monitor your code +can be quite useful and, now that the foundation is here, I plan to experiment +with these ideas using both JSHint and +JSHint.com.

+ +

Stay tuned!

+
+
+
+ + + + diff --git a/contribute/index.html b/contribute/index.html new file mode 100644 index 0000000..09d3f34 --- /dev/null +++ b/contribute/index.html @@ -0,0 +1,270 @@ + + + + + Contribute to JSHint + + + + + + + + + + + + + + + + + + + + +
+
+
+

This page's content is sourced from the JSHint project repository. If you spot an error, please open an issue or (better yet) make a pull request!

+ +

How to contribute

+ +

Contributions to the project generally take one of three forms:

+ +
  • Bug reports
  • Feature requests
  • Patches
+ +

This document describes the best way to contribute each of these. The +maintenance team will assign one of the following labels to document the +report's severity:

+ +
  • P1: Something is throwing exceptions; broken JSHint backward compatibility.
  • P2: Something is not being parsed correctly.
  • P3: Features that the core team will work on once P2s and P1s are done.
  • P4: Patches welcome; The request is good, but low priority.
+ +

Bug Reports

+ +

If you believe you have identified incorrect behavior, please let the team know +by filing an issue. In order to help the team diagnose and fix the problem, the +issue report should have the following information:

+ +
  • Version of JSHint being used
  • Input source code (simplified to only contain details necessary to +demonstrate the problem)
  • Configuration values
  • Description of expected behavior
  • Description of actual behavior
+ +

Feature Requests

+ +

If there is some new functionality that you think would improve JSHint, we'd +love to hear about it! Great feature requests contain the following +information:

+ +
  • Description of problem the feature solves
  • Outline of the feature's intended operation
  • List of any edge cases/exceptional circumstances, and how they should be +addressed
+ +

If you are capable of implementing the feature and submitting a patch, then all +the better! Please begin by making a feature request so that the maintainers +can verify that it is appropriate and help shape its design.

+ +

Patches

+ +

The best way to make sure your issue is addressed is to submit a patch. We +accept patches through all mediums: pull requests, email, issue comment, tweet +with a link to a snippet, etc.

+ +

However, before sending a patch, please make sure that the following applies:

+ +
  • Your commit message follows the Commit Message Guidelines.
  • You have signed the Contributor's License Agreement.
  • Your patch doesn't have useless merge commits.
  • Your coding style is similar to ours (see below).
  • Your patch is 100% tested. We don't accept any test regressions.
  • All tests and lint checks pass (npm test).
  • You understand that we're super grateful for your patch.
+ +

Development Environment

+ +

JSHint is developed using Node.js and has a number of +dependencies specified in its package.json file. To install them just run the +following command from within your repo directory:

+ +
$ npm install
+ +

After that, you will be able to run the edge version of JSHint using +bin/jshint or build the release bundles using bin/build.

+ +

Coding Style

+ +

This section describes our coding style guide. You might not agree with it and +that's fine but if you're going to send us patches treat this guide as a law.

+ +

Our main rule is simple:

+ +

All code in any code-base should look like a single person typed it, no +matter how many people contributed. +—idiomatic.js

+ +

Whitespace

+ +
  • We use two spaces everywhere.
  • Use one space after if, for, while, etc.
  • No spaces between function and ( for anonymous functions, no space between name and ( for named functions:

    var a = function() {};
    +function a() {}
  • Feel free to indent variable assignments or property definitions if it makes the code look better. But don't abuse that:

    // Good
    +var next = token.peak();
    +var prev = token.peak(-1);
    +var cur  = token.current;
    +
    +var scope = {
    +  name:   "(global)",
    +  parent: parentScope,
    +  vars:   [],
    +  uses:   []
    +};
    +
    +// Bad
    +var cur         = token.current;
    +var isSemicolon = cur.isPunctuator(";");
  • Wrap multi-line comments with new lines on both sides.

+ +

Variables

+ +
  • Use one var per variable unless you don't assign any values to it (and it's short enough):

    var token = tokens.find(index);
    +var scope = scopes.current;
    +var next, prev, cur;
  • Don't be overly descriptive with your variable names but don't abuse one-letter variables either. Find a sweet spot somewhere in between.

+ +

Comments

+ +
  • Comment everything that is not obvious.
  • If you're adding a new check, write a comment describing why this check is important and what it checks for.
+ +

Misc

+ +
  • Always use strict mode.
  • Always use strict comparisons: === and !==.
  • Use semicolons.
  • Don't use comma-first notation.
  • Try not to chain stuff unless it really helps (e.g. in tests).
  • Don't short-circuit expressions if you're not assigning the result:

    // Good
    +token = token || tokens.find(0);
    +
    +// Bad
    +token.isPunctuator(";") && report.addWarning("W001");
    +
    +// Good
    +if (token.isPunctuator(";"))
    +  report.addWarning("W001");
+ +

Commit Message Guidelines

+ +

Commit messages are written in a simple format which clearly describes the purpose of a change.

+ +

The format in general should look like this:

+ +
[[TYPE]] <Short description>
+<Blank line>
+
+<Body / Detailed description>
+
+<Footer>
+ +

Line lengths in commit messages are not strict, but good commit messages should have headers of no +more than 60 characters, and bodies/footers wrapped at 100 columns. This renders nicely on Github's +UI.

+ +

Header

+ +

The first line is the commit message header, which will indicate the type of change, and a general +description of the change. This should fit within 60 characters, ideally. For instance:

+ +
[[FIX]] Ignore "nocomma" when parsing object literals
+ +

The title [[FIX]] indicates that the change is a bugfix, while the remainder clarifies what the +change actually contains.

+ +

Several commit types are used by jshint:

+ +
  1. [[FIX]] --- Commit fixes a bug or regression
  2. [[FEAT]] --- Commit introduces new functionality
  3. [[DOCS]] --- Commit modifies documentation. Docs commits should only touch comments in source code, or scripts and assets which are used to generate the documentation.
  4. [[TEST]] --- Commit modifies tests or test infrastructure only
  5. [[CHORE]] --- Commit affects dev-ops, CI, or package dependencies
+ +

Body

+ +

<Body> is a detailed commit message explaining exactly what has changed, and a summary of the +reason why. Lines in the body should be wrapped to 100 characters for best rendering.

+ +

For a historical example, see this example

+ +

Footer

+ +

<Footer> contains a description of any breaking changes, no matter how subtle, as well as a list +of issues affected or fixed by this commit. Lines in the footer should be wrapped to 100 characters +for best rendering.

+ +

For instance:

+ +
[[FEAT]] Enable `norecurs` option by default
+
+Commit 124124a7f introduced an option which forbids recursion. We liked it so much, we've enabled
+it by default.
+
+BREAKING CHANGE:
+
+This change will break the CI builds of many applications and frameworks.
+
+In order to work around this issue, you will need to re-engineer your applications and frameworks
+to avoid making recursive calls. Use Arrays as stacks rather than relying on the VM call stack.
+
+Fixes #1000009
+Closes #888888
+Closes #77777
+
+ +
+ +
+
+
+ + + + diff --git a/docs/api/index.html b/docs/api/index.html new file mode 100644 index 0000000..eac1498 --- /dev/null +++ b/docs/api/index.html @@ -0,0 +1,197 @@ + + + + + JSHint API + + + + + + + + + + + + + + + + + + + + +
+
+
+

Application Programming Interface

+ +

JSHint exposes a JavaScript API for programmatic access in environments like +web browsers and Node.js.

+ +

JSHINT( source, options, predef )

+ +

Analyze source code for errors and potential problems.

+ +

Parameters:

+ +
  • source
    • Description: The input JavaScript source code
    • Type: string or an array of strings (each element is interpreted as a +newline)
    • Example: JSHINT(["'use strict';", "console.log('hello, world!');"]);
  • options
    • Description: The linting options to use when analyzing +the source code
    • Type: an object whose property names are the desired options to use and +whose property values are the configuration values for those properties.
    • Example: JSHINT(mySource, { undef: true });
  • predef
    • Description: variables defined outside of the current file; the behavior of +this argument is identical to the globals linting +option
    • Type: an object whose property names are the global variable identifiers +and whose property values control whether each variable should be +considered read-only
    • Example: JSHINT(mySource, myOptions, { jQuery: false });
+ +

JSHINT.errors

+ +

An array of warnings and errors generated by the most recent invocation of +JSHINT.

+ +

JSHINT.data()

+ +

Generate a report containing details about the most recent invocation of +JSHINT.

+ +

For example, the following code:

+ +
var source = [
+  'function goo() {}',
+  'foo = 3;'
+];
+var options = {
+  undef: true
+};
+var predef = {
+  foo: false
+};
+
+JSHINT(source, options, predef);
+
+console.log(JSHINT.data());
+ +

...will produce the following output:

+ +
{
+  functions: [
+    {
+      name: 'goo',
+      param: undefined,
+      line: 1,
+      character: 14,
+      last: 1,
+      lastcharacter: 18,
+      metrics: {
+        complexity: 1,
+        parameters: 0,
+        statements: 0
+      }
+    }
+  ],
+  options: {
+    undef: true,
+    indent: 4,
+    maxerr: 50
+  },
+  errors: [
+    {
+      id: '(error)',
+      raw: 'Read only.',
+      code: 'W020',
+      evidence: 'foo = 3;',
+      line: 2,
+      character: 1,
+      scope: '(main)',
+      a: undefined,
+      b: undefined,
+      c: undefined,
+      d: undefined,
+      reason: 'Read only.'
+    }
+  ],
+  globals: [
+    'goo',
+    'foo'
+  ],
+  unused: [
+    {
+      name: 'goo',
+      line: 1, character: 10
+    }
+  ]
+}
+
+ +
+ +
+
+
+ + + + diff --git a/docs/cli/index.html b/docs/cli/index.html new file mode 100644 index 0000000..9b46747 --- /dev/null +++ b/docs/cli/index.html @@ -0,0 +1,334 @@ + + + + + JSHint CLI flags + + + + + + + + + + + + + + + + + + + + +
+
+
+

Command-line Interface

+ +

The JSHint CLI can be installed via npm (see the Installation page +for instructions).

+ +

Contents: Specifying Input · Specifying Linting +Options · Special Options · +Ignoring Files · Flags

+ + + +

Specifying Input

+ +

The jshint executable accepts paths to files, which it will read and lint:

+ +
$ jshint myfile.js
+myfile.js: line 10, col 39, Octal literals are not allowed in strict mode.
+
+1 error
+ +

If a file path is a dash (-) then JSHint will read from standard input.

+ + + +

Specifying Linting Options

+ +

The jshint executable is capable of applying linting options +specified in an external JSON-formatted file. Such a file +might look like this:

+ +
{
+  "curly": true,
+  "eqeqeq": true,
+  "nocomma": true
+}
+ +

jshint will look for this configuration in a number of locations, stopping at +the first positive match:

+ +
  1. The location specified with the --config flag
  2. A file named package.json located in the current directory or any parent +of the current directory (the configuration should be declared as the +jshintConfig attribute of that file's JSON value)
  3. A file named .jshintrc located in the current directory or any parent of +the current directory
  4. A file named .jshintrc located in the current user's "home" directory +(where defined)
+ +

If this search yields no results, jshint will lint the input code as if no +linting rules had been enabled.

+ +

The command-line interface offers some special options in +addition to the ones available in other contexts

+ + + +

Special Options

+ +

The following options concern the file system and are only available from +within configuration files (i.e. not from inline directives or the API):

+ +

extends

+ +

Use another configuration file as a "base". The value of this option should be +a file path to another configuration file, and the path should be relative to +the current file.

+ +

For example, you might define a .jshintrc file in the top-level directory of +your project (say, `./.jshintrc') to specify the linting +options you would like to use in your entire project:

+ +
{
+  "undef": true,
+  "unused": true
+}
+ +

You may want to re-use this configuration for your project's automated tests, +but also allow for global +variables that are specific to the +test environment. In this case, you could create a a new file in their test +directory, (./test/.jshintrc for example), and include the following +configuration:

+ +
{
+  "extends": "../.jshintrc",
+  "globals": {
+    "test": false,
+    "assert": false
+  }
+}
+ +

overrides

+ +

Specify options that should only be applied to files matching a given path +pattern.

+ +

The following configuration file disallows variable +shadowing for all files and allows expressions as +statements for only those files ending in -test.js:

+ +
{
+  "shadow": false,
+  "overrides": {
+    "lib/*-test.js": {
+      "expr": true
+    }
+  }
+}
+ + + +

Ignoring Files

+ +

jshint can be configured to ignore files based on their location in the +filesystem. You may create a dedicated "ignore" file to list any number of file +names, file paths, or file path patterns that should not be linted. Path +patterns will be interpreted using the minimatch npm +module, which itself is based on the +Unix filename matching syntax, fnmatch.

+ +
build/
+src/**/tmp.js
+ +

jshint will look for this configuration in a number of locations, stopping at +the first positive match:

+ +
  1. The location specified with the --exclude-path flag
  2. A file named .jshintignore located in the current directory or any parent +of the current directory
+ +

If this search yields no results, jshint will not ignore any files.

+ + + +

Flags

+ +

--config

+ +

Explicitly sets the location on the file system from which jshint should load +linting options.

+ +
$ jshint --config ../path/to/my/config.json
+ +

--reporter

+ +

Allows you to modify JSHint's output by replacing its default output function +with your own implementation.

+ +
$ jshint --reporter=myreporter.js myfile.js
+ +

This flag also supports two pre-defined reporters: jslint, to make output +compatible with JSLint, and checkstyle, to make output compatible with +CheckStyle XML.

+ +
$ jshint --reporter=checkstyle myfile.js
+<?xml version="1.0" encoding="utf-8"?>
+<checkstyle version="4.3">
+  <file name="myfile.js">
+    <error line="10" column="39" severity="error"
+      message="Octal literals are not allowed in strict mode."/>
+  </file>
+</checkstyle>
+ +

See also: Writing your own JSHint reporter.

+ +

--verbose

+ +

Adds message codes to the JSHint output.

+ +

--show-non-errors

+ +

Shows additional data generated by JSHint.

+ +
$ jshint --show-non-errors myfile.js
+myfile.js: line 10, col 39, Octal literals are not allowed in strict mode.
+
+1 error
+
+myfile.js:
+  Unused variables:
+    foo, bar
+ +

--extra-ext

+ +

Allows you to specify additional file extensions to check (default is .js).

+ +

--extract=[auto|always|never]

+ +

Tells JSHint to extract JavaScript from HTML files before linting:

+ +
tmp ☭ cat test.html
+<html>
+  <head>
+    <title>Hello, World!</title>
+    <script>
+      function hello() {
+        return "Hello, World!";
+      }
+    </script>
+  </head>
+  <body>
+    <h1>Hello, World!</h1>
+    <script>
+      console.log(hello())
+    </script>
+  </body>
+</html>
+
+tmp ☭ jshint --extract=auto test.html
+test.html: line 13, col 27, Missing semicolon.
+
+1 error
+ +

If you set it to always JSHint will always attempt to extract JavaScript. +And if you set it to auto it will make an attempt only if file looks +like it's an HTML file.

+ +

--exclude

+ +

Allows you to specify directories which you DON'T want to be linted.

+ +

--exclude-path

+ +

Allows you to provide your own .jshintignore file. For example, you can point +JSHint to your .gitignore file and use it instead of default .jshintignore.

+ +

--prereq

+ +

Allows you to specify prerequisite files i.e. files which include definitions +of global variables used throughout your project.

+ +

--help

+ +

Shows a nice little help message similar to what you're reading right now.

+ +

--version

+ +

Shows the installed version of JSHint.

+
+ +
+ +
+
+
+ + + + diff --git a/docs/faq/index.html b/docs/faq/index.html new file mode 100644 index 0000000..0448f9f --- /dev/null +++ b/docs/faq/index.html @@ -0,0 +1,162 @@ + + + + + FAQ + + + + + + + + + + + + + + + + + + + + +
+
+
+

Frequently Asked Questions

+ +

Can I use multiple reporters at the same time?

+ +

Yes, you may do so by authoring a new reporter that composes the reporters you +are interested in using.

+ +

For example, to use reporters named first-reporter and second-reporter, +create a new module that invokes them both:

+ +
var first = require('first-reporter');
+var second = require('second-reporter');
+
+exports.reporter = function(results, data, opts) {
+  first.reporter(results, data, opts);
+  second.reporter(results, data, opts);
+};
+ +

Save that to a file named dual-reporter.js, and run JSHint with:

+ +
$ jshint --reporter ./dual-reporter.js
+ +

...and you should see the output of first-reporter followed by the output of +second-reporter.

+ +

This approach is especially well-suited to using the different reporters' +output in different contexts (for instance, e-mailing one reporter's output to +the development team and feeding another reporter's output to a continuous +integration system). You might output a custom delimiter between the output +streams in order to demultiplex them. Alternatively, you might replace the +global process.stdout value with another stream between reporter invocations. +This latter solution is somewhat fragile because it involves mutating global +state--a future release of JSHint may expose a safer mechanism for this +operation.

+ +

See the documentation on JSHint's "reporter" +API for more details on creating your own +reporter.

+ +

JSHint skips some unused variables

+ +

If your code looks like this:

+ +
function test(a, b, c) {
+  return c;
+}
+ +

Then JSHint will not warn about unused variables a and b if you set the +unused option to true. It figures that if unused arguments are followed +by used ones, it was a conscious decision and not a typo. If you want to +warn about all unused variables not matter where they appear, set the unused +option to strict:

+ +
/*jshint unused:strict */
+function test(a, b, c) {
+  return c;
+}
+
+// Warning: unused variable 'a'
+// Warning: unused variable 'b'
+ +

For more information see: options/unused.

+
+ +
+ +
+
+
+ + + + diff --git a/docs/index.html b/docs/index.html new file mode 100644 index 0000000..5dd47e9 --- /dev/null +++ b/docs/index.html @@ -0,0 +1,341 @@ + + + + + JSHint Documentation + + + + + + + + + + + + + + + + + + + + +
+
+
+

Documentation

+ +

JSHint is a program that flags suspicious usage in programs written in JavaScript. +The core project consists of a library itself as well as a CLI program distributed +as a Node module.

+ +

More docs: List of all JSHint options · Command-line +Interface · API · Writing your own +reporter · FAQ

+ +

Basic usage

+ +

First, check out the installation instructions for details on +how to install JSHint in your preferred environment. Both the command line +executable and the JavaScript API offer unique ways to configure JSHint's +behaviour. The most common usages are:

+ + + +

Regardless of your preferred environment, you can control JSHint's behavior +through specifying any number of linting options. In +addition, JSHint will honor any directives declared within the input source +code--see the section on in-line directives for more +information.

+ +

Configuration

+ +

JSHint comes with a default set of warnings but it was designed to be very +configurable. There are three main ways to configure your copy of JSHint: +you can either specify the configuration file manually via the --config flag, +use a special file .jshintrc or put your config into your projects package.json +file under the jshintConfig property. In case of .jshintrc, JSHint will start +looking for this file in the same directory as the file that's being linted. +If not found, it will move one level up the directory tree all the way up to +the filesystem root. (Note that if the input comes from stdin, JSHint doesn't +attempt to find a configuration file)

+ +

This setup allows you to have different configuration files per project. Place +your file into the project root directory and, as long as you run JSHint from +anywhere within your project directory tree, the same configuration file will +be used.

+ +

Configuration file is a simple JSON file that specifies which JSHint options +to turn on or off. For example, the following file will enable warnings about +undefined and unused variables and tell JSHint about a global variable named +MY_GLOBAL.

+ +
{
+  "undef": true,
+  "unused": true,
+  "globals": {
+    "MY_GLOBAL": true
+  }
+}
+ + + +

Inline configuration

+ +

In addition to using configuration files you can configure JSHint from within your +files using special comments. These comments start with a label such as +jshint or globals (complete list below) and are followed by a +comma-separated list of values. For example, the following snippet will enable +warnings about undefined and unused variables and tell JSHint about a global +variable named MY_GLOBAL.

+ +
/* jshint undef: true, unused: true */
+/* globals MY_GLOBAL */
+ +

You can use both multi- and single-line comments to configure JSHint. These +comments are function scoped meaning that if you put them inside a function they +will affect only this function's code.

+ +

Directives

+ +

Here's a list of configuration directives supported by JSHint:

+ +

jshint

+ +

A directive for setting JSHint options.

+ +
/* jshint strict: true */
+ +

jslint

+ +

A directive for setting JSHint-compatible JSLint options.

+ +
/* jslint vars: true */
+ +

globals

+ +

A directive for telling JSHint about global variables that are defined +elsewhere. If value is false (default), JSHint will consider that variable +as read-only. Use it together with the undef option.

+ +
/* globals MY_LIB: false */
+ +

You can also blacklist certain global variables to make sure they are not used +anywhere in the current file.

+ +
/* globals -BAD_LIB */
+ +

exported

+ +

A directive for telling JSHint about global variables that are defined in the +current file but used elsewhere. Use it together with the unused option.

+ +
/* exported EXPORTED_LIB */
+ +

members

+ +

A directive for telling JSHint about all properties you intend to use. This +directive is deprecated.

+ +

ignore

+ +

A directive for telling JSHint to ignore a block of code.

+ +
// Code here will be linted with JSHint.
+/* jshint ignore:start */
+// Code here will be ignored by JSHint.
+/* jshint ignore:end */
+ +

All code in between ignore:start and ignore:end won't be passed to JSHint +so you can use any language extension such as Facebook React. +Additionally, you can ignore a single line with a trailing comment:

+ +
ignoreThis(); // jshint ignore:line
+ +

Options

+ +

Most often, when you need to tune JSHint to your own taste, all you need to do +is to find an appropriate option. Trying to figure out how JSHint options work +can be confusing and frustrating (and we're working on fixing that!) so please +read the following couple of paragraphs carefully.

+ +

JSHint has two types of options: enforcing and relaxing. The former are used to +make JSHint more strict while the latter are used to suppress some warnings. +Take the following code as an example:

+ +
function main(a, b) {
+  return a == null;
+}
+ +

This code will produce the following warning when run with default JSHint +options:

+ +
line 2, col 14, Use '===' to compare with 'null'.
+ +

Let's say that you know what you're doing and want to disable the produced +warning but, in the same time, you're curious whether you have any variables +that were defined but never used. What you need to do, in this case, is to +enable two options: one relaxing that will suppress the === null warning and +one enforcing that will enable checks for unused variables. In your case these +options are unused and eqnull.

+ +
/*jshint unused:true, eqnull:true */
+function main(a, b) {
+  return a == null;
+}
+ +

After that, JSHint will produce the following warning while linting this example +code:

+ +
demo.js: line 2, col 14, 'main' is defined but never used.
+demo.js: line 2, col 19, 'b' is defined but never used.
+ +

Sometimes JSHint doesn't have an appropriate option that disables some +particular warning. In this case you can use jshint directive to disable +warnings by their code. Let's say that you have a file that was created by +combining multiple different files into one:

+ +
"use strict";
+/* ... */
+
+// From another file
+function b() {
+  "use strict";
+  /* ... */
+}
+ +

This code will trigger a warning about an unnecessary directive in function b. +JSHint sees that there's already a global "use strict" directive and informs you +that all other directives are redundant. But you don't want to strip out these +directives since the file was auto-generated. The solution is to run JSHint +with a flag --verbose and note the warning code (W034 in this case):

+ +
$ jshint --verbose myfile.js
+myfile.js: line 6, col 3, Unnecessary directive "use strict". (W034)
+ +

Then, to hide this warning, just add the following snippet to your file:

+ +
/* jshint -W034 */
+ +

A couple things to note:

+ +
  1. This syntax works only with warnings (code starts with W), it doesn't work +with errors (code starts with E).
  2. This syntax will disable all warnings with this code. Some warnings are more +generic than others so be cautious.
+ +

To re-enable a warning that has been disabled with the above snippet you can +use:

+ +
/* jshint +W034 */
+ +

This is especially useful when you have code which causes a warning but that +you know is safe in the context. In these cases you can disable the warning as +above and then re-enable the warning afterwards:

+ +
var y = Object.create(null);
+// ...
+/*jshint -W089 */
+for (var prop in y) {
+    // ...
+}
+/*jshint +W089 */
+ +

This page contains a list of all options supported by JSHint.

+ +

Switch statements

+ +

By default JSHint warns when you omit break or return statements within +switch statements:

+ +
switch (cond) {
+case "one":
+  doSomething(); // JSHint will warn about missing 'break' here.
+case "two":
+  doSomethingElse();
+}
+ +

If you really know what you're doing you can tell JSHint that you intended the +case block to fall through by adding a /* falls through */ comment:

+ +
switch (cond) {
+case "one":
+  doSomething();
+  /* falls through */
+case "two":
+  doSomethingElse();
+}
+
+ +
+ +
+
+
+ + + + diff --git a/docs/options/index.html b/docs/options/index.html new file mode 100644 index 0000000..c70e55e --- /dev/null +++ b/docs/options/index.html @@ -0,0 +1,1457 @@ + + + + + JSHint Options Reference + + + + + + + + + + + + + + + + + + + + +
+
+
+

JSHint Options

+ + +This page's content is sourced from the JSHint +project repository. If you spot an error, please open an issue or (better yet) make +a pull request! + +

Enforcing options

+ +

When set to true, these options will make JSHint produce more warnings about your code.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ bitwise + + +

This option prohibits the use of bitwise operators such as ^ (XOR), +| (OR) and others. Bitwise operators are very rare in JavaScript +programs and quite often & is simply a mistyped &&.

+
+ camelcase + + +
+ Warning This option has been deprecated and will be + removed in the next major release of JSHint. +

JSHint is limiting its scope to issues of code correctness. If you would like to enforce rules relating to code style, + check out the JSCS + project.

+
+ +

This option allows you to force all variable names to use either +camelCase style or UPPER_CASE with underscores.

+
+ curly + + +

This option requires you to always put curly braces around blocks in +loops and conditionals. JavaScript allows you to omit curly braces when +the block consists of only one statement, for example:

while (day)
+  shuffle();
+

However, in some circumstances, it can lead to bugs (you'd think that +sleep() is a part of the loop while in reality it is not):

while (day)
+  shuffle();
+  sleep();
+
+
+ enforceall + + +
+ Warning This option has been deprecated and will be + removed in the next major release of JSHint. +

The option cannot be maintained without automatically opting users in to new features. This can lead to unexpected + warnings/errors in when upgrading between minor versions of + JSHint.

+
+ +

This option is a short hand for the most strict JSHint configuration as +available in JSHint version 2.6.3. It enables all enforcing options and +disables all relaxing options that were defined in that release.

+
+ eqeqeq + + +

This options prohibits the use of == and != in favor of === and +!==. The former try to coerce values before comparing them which can +lead to some unexpected results. The latter don't do any coercion so +they are generally safer. If you would like to learn more about type +coercion in JavaScript, we recommend Truth, Equality and +JavaScript +by Angus Croll.

+
+ es3 + + +
+ Warning This option has been deprecated and will be + removed in the next major release of JSHint. +

Use esversion: 3 instead.

+
+ +

This option tells JSHint that your code needs to adhere to ECMAScript 3 +specification. Use this option if you need your program to be executable +in older browsers—such as Internet Explorer 6/7/8/9—and other legacy +JavaScript environments.

+
+ es5 + + +
+ Warning This option has been deprecated and will be + removed in the next major release of JSHint. +

Use esversion: 5 instead.

+
+ +

This option enables syntax first defined in the ECMAScript 5.1 +specification. This includes allowing reserved +keywords as object properties.

+
+ esversion + + +

This option is used to specify the ECMAScript version to which the code +must adhere. It can assume one of the following values:

    +
  • 3 - If you need your program to be executable +in older browsers—such as Internet Explorer 6/7/8/9—and other legacy +JavaScript environments
  • +
  • 5 - To enable syntax first defined in the ECMAScript 5.1 +specification. +This includes allowing reserved keywords as object properties.
  • +
  • 6 - To tell JSHint that your code uses ECMAScript +6 specific +syntax. Note that not all browsers implement them.
  • +
+ +
+ forin + + +

This option requires all for in loops to filter object's items. The +for in statement allows for looping through the names of all of the +properties of an object including those inherited through the prototype +chain. This behavior can lead to unexpected items in your object so it +is generally safer to always filter inherited properties out as shown in +the example:

for (key in obj) {
+  if (obj.hasOwnProperty(key)) {
+    // We are sure that obj[key] belongs to the object and was not inherited.
+  }
+}
+

For more in-depth understanding of for in loops in JavaScript, read +Exploring JavaScript for-in +loops +by Angus Croll.

+
+ freeze + + +

This options prohibits overwriting prototypes of native objects such as +Array, Date and so on.

// jshint freeze:true
+Array.prototype.count = function (value) { return 4; };
+// -> Warning: Extending prototype of native object: 'Array'.
+
+
+ funcscope + + +

This option suppresses warnings about declaring variables inside of +control +structures while accessing them later from the outside. Even though +JavaScript has only two real scopes—global and function—such practice +leads to confusion among people new to the language and hard-to-debug +bugs. This is why, by default, JSHint warns about variables that are +used outside of their intended scope.

function test() {
+  if (true) {
+    var x = 0;
+  }
+
+  x += 1; // Default: 'x' used out of scope.
+            // No warning when funcscope:true
+}
+
+
+ futurehostile + + +

This option enables warnings about the use of identifiers which are +defined in future versions of JavaScript. Although overwriting them has +no effect in contexts where they are not implemented, this practice can +cause issues when migrating codebases to newer versions of the language.

+
+ globals + + +

This option can be used to specify a white list of global variables that +are not formally defined in the source code. This is most useful when +combined with the undef option in order to suppress warnings for +project-specific global variables.

Setting an entry to true enables reading and writing to that variable. +Setting it to false will trigger JSHint to consider that variable +read-only.

See also the "environment" options: a set of options to be used as short +hand for enabling global variables defined in common JavaScript +environments.

To configure globals within an individual file, see Inline +Configuration.

+
+ immed + + +
+ Warning This option has been deprecated and will be + removed in the next major release of JSHint. +

JSHint is limiting its scope to issues of code correctness. If you would like to enforce rules relating to code style, + check out the JSCS + project.

+
+ +

This option prohibits the use of immediate function invocations without +wrapping them in parentheses. Wrapping parentheses assists readers of +your code in understanding that the expression is the result of a +function, and not the function itself.

+
+ indent + + +
+ Warning This option has been deprecated and will be + removed in the next major release of JSHint. +

JSHint is limiting its scope to issues of code correctness. If you would like to enforce rules relating to code style, check + out the JSCS project.

+
+ +

This option sets a specific tab width for your code.

+
+ iterator + + +

This option suppresses warnings about the __iterator__ property. This +property is not supported by all browsers so use it carefully.

+
+ latedef + + +

This option prohibits the use of a variable before it was defined. +JavaScript has function scope only and, in addition to that, all variables +are always moved—or hoisted— to the top of the function. This behavior can +lead to some very nasty bugs and that's why it is safer to always use +variable only after they have been explicitly defined.

Setting this option to "nofunc" will allow function declarations to be +ignored.

For more in-depth understanding of scoping and hoisting in JavaScript, +read JavaScript Scoping and +Hoisting +by Ben Cherry.

+
+ maxcomplexity + + +

This option lets you control cyclomatic complexity throughout your code. +Cyclomatic complexity measures the number of linearly independent paths +through a program's source code. Read more about cyclomatic complexity on +Wikipedia.

+
+ maxdepth + + +

This option lets you control how nested do you want your blocks to be:

// jshint maxdepth:2
+
+function main(meaning) {
+  var day = true;
+
+  if (meaning === 42) {
+    while (day) {
+      shuffle();
+
+      if (tired) { // JSHint: Blocks are nested too deeply (3).
+          sleep();
+      }
+    }
+  }
+}
+
+
+ maxerr + + +

This options allows you to set the maximum amount of warnings JSHint will +produce before giving up. Default is 50.

+
+ maxlen + + +
+ Warning This option has been deprecated and will be + removed in the next major release of JSHint. +

JSHint is limiting its scope to issues of code correctness. If you would like to enforce rules relating to code style, check + out the JSCS project.

+
+ +

This option lets you set the maximum length of a line.

+
+ maxparams + + +

This option lets you set the max number of formal parameters allowed per +function:

// jshint maxparams:3
+
+function login(request, onSuccess) {
+  // ...
+}
+
+// JSHint: Too many parameters per function (4).
+function logout(request, isManual, whereAmI, onSuccess) {
+  // ...
+}
+
+
+ maxstatements + + +

This option lets you set the max number of statements allowed per function:

// jshint maxstatements:4
+
+function main() {
+  var i = 0;
+  var j = 0;
+
+  // Function declarations count as one statement. Their bodies
+  // don't get taken into account for the outer function.
+  function inner() {
+    var i2 = 1;
+    var j2 = 1;
+
+    return i2 + j2;
+  }
+
+  j = i + j;
+  return j; // JSHint: Too many statements per function. (5)
+}
+
+
+ newcap + + +
+ Warning This option has been deprecated and will be + removed in the next major release of JSHint. +

JSHint is limiting its scope to issues of code correctness. If you would like to enforce rules relating to code style, + check out the JSCS + project.

+
+ +

This option requires you to capitalize names of constructor functions. +Capitalizing functions that are intended to be used with new operator +is just a convention that helps programmers to visually distinguish +constructor functions from other types of functions to help spot +mistakes when using this.

Not doing so won't break your code in any browsers or environments but +it will be a bit harder to figure out—by reading the code—if the +function was supposed to be used with or without new. And this is +important because when the function that was intended to be used with +new is used without it, this will point to the global object instead +of a new object.

+
+ noarg + + +

This option prohibits the use of arguments.caller and +arguments.callee. Both .caller and .callee make quite a few +optimizations impossible so they were deprecated in future versions of +JavaScript. In fact, ECMAScript 5 forbids the use of arguments.callee +in strict mode.

+
+ nocomma + + +

This option prohibits the use of the comma operator. When misused, the +comma operator can obscure the value of a statement and promote +incorrect code.

+
+ noempty + + +
+ Warning This option has been deprecated and will be + removed in the next major release of JSHint. +

JSHint is limiting its scope to issues of code correctness. If you would like to enforce rules relating to code style, + check out the JSCS + project.

+
+ +

This option warns when you have an empty block in your code. JSLint was +originally warning for all empty blocks and we simply made it optional. +There were no studies reporting that empty blocks in JavaScript break +your code in any way.

+
+ nonbsp + + +

This option warns about "non-breaking whitespace" characters. These +characters can be entered with option-space on Mac computers and have a +potential of breaking non-UTF8 web pages.

+
+ nonew + + +

This option prohibits the use of constructor functions for side-effects. +Some people like to call constructor functions without assigning its +result to any variable:

new MyConstructor();
+

There is no advantage in this approach over simply calling +MyConstructor since the object that the operator new creates isn't +used anywhere so you should generally avoid constructors like this one.

+
+ notypeof + + +

This option suppresses warnings about invalid typeof operator values. +This operator has only a limited set of possible return +values. +By default, JSHint warns when you compare its result with an invalid +value which often can be a typo.

// 'fuction' instead of 'function'
+if (typeof a == "fuction") { // Invalid typeof value 'fuction'
+  // ...
+}
+

Do not use this option unless you're absolutely sure you don't want +these checks.

+
+ predef + + +

This option allows you to control which variables JSHint considers to be +implicitly defined in the environment. Configure it with an array of +string values. Prefixing a variable name with a hyphen (-) character will +remove that name from the collection of predefined variables.

JSHint will consider variables declared in this way to be read-only.

This option cannot be specified in-line; it may only be used via the +JavaScript API or from an external configuration file.

+
+ quotmark + + +
+ Warning This option has been deprecated and will be + removed in the next major release of JSHint. +

JSHint is limiting its scope to issues of code correctness. If you would like to enforce rules relating to code style, check + out the JSCS project.

+
+ +

This option enforces the consistency of quotation marks used throughout +your code. It accepts three values: true if you don't want to enforce +one particular style but want some consistency, "single" if you want to +allow only single quotes and "double" if you want to allow only double +quotes.

+
+ shadow + + +

This option suppresses warnings about variable shadowing i.e. declaring a +variable that had been already declared somewhere in the outer scope.

    +
  • "inner" - check for variables defined in the same scope only
  • +
  • "outer" - check for variables defined in outer scopes as well
  • +
  • false - same as inner
  • +
  • true - allow variable shadowing
  • +
+ +
+ singleGroups + + +

This option prohibits the use of the grouping operator when it is not +strictly required. Such usage commonly reflects a misunderstanding of +unary operators, for example:

// jshint singleGroups: true
+
+delete(obj.attr); // Warning: Unnecessary grouping operator.
+
+
+ strict + + +

This option requires the code to run in ECMAScript 5's strict mode. +Strict mode +is a way to opt in to a restricted variant of JavaScript. Strict mode +eliminates some JavaScript pitfalls that didn't cause errors by changing +them to produce errors. It also fixes mistakes that made it difficult +for the JavaScript engines to perform certain optimizations.

    +
  • "global" - there must be a "use strict"; directive at global level
  • +
  • "implied" - lint the code as if there is the "use strict"; directive
  • +
  • false - disable warnings about strict mode
  • +
  • true - there must be a "use strict"; directive at function level;
            this is preferable for scripts intended to be loaded in web
    +        browsers directly because enabling strict mode globally
    +        could adversely effect other scripts running on the same
    +        page
    +
  • +
+ +
+ undef + + +

This option prohibits the use of explicitly undeclared variables. This +option is very useful for spotting leaking and mistyped variables.

// jshint undef:true
+
+function test() {
+  var myVar = 'Hello, World';
+  console.log(myvar); // Oops, typoed here. JSHint with undef will complain
+}
+

If your variable is defined in another file, you can use the global +directive to tell JSHint about it.

+
+ unused + + +

This option warns when you define and never use your variables. It is very +useful for general code cleanup, especially when used in addition to +undef.

// jshint unused:true
+
+function test(a, b) {
+  var c, d = 2;
+
+  return a + d;
+}
+
+test(1, 2);
+
+// Line 3: 'b' was defined but never used.
+// Line 4: 'c' was defined but never used.
+

In addition to that, this option will warn you about unused global +variables declared via the global directive.

This can be set to vars to only check for variables, not function +parameters, or strict to check all variables and parameters. The +default (true) behavior is to allow unused parameters that are followed by +a used parameter.

+
+ varstmt + + +

When set to true, the use of VariableStatements are forbidden. +For example:

// jshint varstmt: true
+
+var a; // Warning: `var` declarations are forbidden. Use `let` or `const` instead.
+
+
+ + +

Relaxing options

+ +

When set to true, these options will make JSHint produce fewer warnings about your code.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ asi + + +

This option suppresses warnings about missing semicolons. There is a lot +of FUD about semicolon spread by quite a few people in the community. +The common myths are that semicolons are required all the time (they are +not) and that they are unreliable. JavaScript has rules about semicolons +which are followed by all browsers so it is up to you to decide +whether you should or should not use semicolons in your code.

For more information about semicolons in JavaScript read An Open Letter +to JavaScript Leaders Regarding +Semicolons +by Isaac Schlueter and JavaScript Semicolon +Insertion.

+
+ boss + + +

This option suppresses warnings about the use of assignments in cases +where comparisons are expected. More often than not, code like if (a = +10) {} is a typo. However, it can be useful in cases like this one:

for (var i = 0, person; person = people[i]; i++) {}
+

You can silence this error on a per-use basis by surrounding the assignment +with parenthesis, such as:

for (var i = 0, person; (person = people[i]); i++) {}
+
+
+ debug + + +

This option suppresses warnings about the debugger statements in your +code.

+
+ elision + + +

This option tells JSHint that your code uses ES3 array elision elements, +or empty elements (for example, [1, , , 4, , , 7]).

+
+ eqnull + + +

This option suppresses warnings about == null comparisons. Such +comparisons are often useful when you want to check if a variable is +null or undefined.

+
+ esnext + + +
+ Warning This option has been deprecated and will be + removed in the next major release of JSHint. +

Use esversion: 6 instead.

+
+ +

This option tells JSHint that your code uses ECMAScript 6 specific +syntax. Note that not all browsers implement these features.

More info:

+ +
+ evil + + +

This option suppresses warnings about the use of eval. The use of +eval is discouraged because it can make your code vulnerable to +various injection attacks and it makes it hard for JavaScript +interpreter to do certain optimizations.

+
+ expr + + +

This option suppresses warnings about the use of expressions where +normally you would expect to see assignments or function calls. Most of +the time, such code is a typo. However, it is not forbidden by the spec +and that's why this warning is optional.

+
+ globalstrict + + +
+ Warning This option has been deprecated and will be + removed in the next major release of JSHint. +

Use strict: "global".

+
+ +

This option suppresses warnings about the use of global strict mode. +Global strict mode can break third-party widgets so it is not +recommended.

For more info about strict mode see the strict option.

+
+ lastsemic + + +

This option suppresses warnings about missing semicolons, but only when +the semicolon is omitted for the last statement in a one-line block:

var name = (function() { return 'Anton' }());
+

This is a very niche use case that is useful only when you use automatic +JavaScript code generators.

+
+ laxbreak + + +
+ Warning This option has been deprecated and will be + removed in the next major release of JSHint. +

JSHint is limiting its scope to issues of code correctness. If you would like to enforce rules relating to code style, + check out the JSCS + project.

+
+ +

This option suppresses most of the warnings about possibly unsafe line +breakings in your code. It doesn't suppress warnings about comma-first +coding style. To suppress those you have to use laxcomma (see below).

+
+ laxcomma + + +
+ Warning This option has been deprecated and will be + removed in the next major release of JSHint. +

JSHint is limiting its scope to issues of code correctness. If you would like to enforce rules relating to code style, + check out the JSCS + project.

+
+ +

This option suppresses warnings about comma-first coding style:

var obj = {
+    name: 'Anton'
+  , handle: 'valueof'
+  , role: 'SW Engineer'
+};
+
+
+ loopfunc + + +

This option suppresses warnings about functions inside of loops. +Defining functions inside of loops can lead to bugs such as this one:

var nums = [];
+
+for (var i = 0; i < 10; i++) {
+  nums[i] = function (j) {
+    return i + j;
+  };
+}
+
+nums[0](2); // Prints 12 instead of 2
+

To fix the code above you need to copy the value of i:

var nums = [];
+
+for (var i = 0; i < 10; i++) {
+  (function (i) {
+    nums[i] = function (j) {
+        return i + j;
+    };
+  }(i));
+}
+
+
+ moz + + +

This options tells JSHint that your code uses Mozilla JavaScript +extensions. Unless you develop specifically for the Firefox web browser +you don't need this option.

More info:

+ +
+ multistr + + +
+ Warning This option has been deprecated and will be + removed in the next major release of JSHint. +

JSHint is limiting its scope to issues of code correctness. If you would like to enforce rules relating to code style, + check out the JSCS + project.

+
+ +

This option suppresses warnings about multi-line strings. Multi-line +strings can be dangerous in JavaScript because all hell breaks loose if +you accidentally put a whitespace in between the escape character (\) +and a new line.

Note that even though this option allows correct multi-line strings, it +still warns about multi-line strings without escape characters or with +anything in between the escape character and a whitespace.

// jshint multistr:true
+
+var text = "Hello\
+World"; // All good.
+
+text = "Hello
+World"; // Warning, no escape character.
+
+text = "Hello\
+World"; // Warning, there is a space after \
+
+
+ noyield + + +

This option suppresses warnings about generator functions with no +yield statement in them.

+
+ plusplus + + +

This option prohibits the use of unary increment and decrement +operators. Some people think that ++ and -- reduces the quality of +their coding styles and there are programming languages—such as +Python—that go completely without these operators.

+
+ proto + + +

This option suppresses warnings about the __proto__ property.

+
+ scripturl + + +

This option suppresses warnings about the use of script-targeted +URLs—such as javascript:....

+
+ sub + + +
+ Warning This option has been deprecated and will be + removed in the next major release of JSHint. +

JSHint is limiting its scope to issues of code correctness. If you would like to enforce rules relating to code style, + check out the JSCS + project.

+
+ +

This option suppresses warnings about using [] notation when it can be +expressed in dot notation: person['name'] vs. person.name.

+
+ supernew + + +

This option suppresses warnings about "weird" constructions like +new function () { ... } and new Object;. Such constructions are +sometimes used to produce singletons in JavaScript:

var singleton = new function() {
+  var privateVar;
+
+  this.publicMethod  = function () {}
+  this.publicMethod2 = function () {}
+};
+
+
+ validthis + + +

This option suppresses warnings about possible strict violations when +the code is running in strict mode and you use this in a +non-constructor function. You should use this option—in a function scope +only—when you are positive that your use of this is valid in the +strict mode (for example, if you call your function using +Function.call).

Note: This option can be used only inside of a function scope. +JSHint will fail with an error if you will try to set this option +globally.

+
+ withstmt + + +

This option suppresses warnings about the use of the with statement. +The semantics of the with statement can cause confusion among +developers and accidental definition of global variables.

More info:

+ +
+ + +

Environments

+ +

These options let JSHint know about some pre-defined global variables.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ browser + + +

This option defines globals exposed by modern browsers: all the way from +good old document and navigator to the HTML5 FileReader and other +new developments in the browser world.

Note: This option doesn't expose variables like alert or +console. See option devel for more information.

+
+ browserify + + +

This option defines globals available when using the Browserify +tool to build a project.

+
+ couch + + +

This option defines globals exposed by +CouchDB. CouchDB is a document-oriented +database that can be queried and indexed in a MapReduce fashion using +JavaScript.

+
+ devel + + +

This option defines globals that are usually used for logging poor-man's +debugging: console, alert, etc. It is usually a good idea to not +ship them in production because, for example, console.log breaks in +legacy versions of Internet Explorer.

+
+ dojo + + +

This option defines globals exposed by the Dojo +Toolkit.

+
+ jasmine + + +

This option defines globals exposed by the Jasmine unit testing +framework.

+
+ jquery + + +

This option defines globals exposed by the jQuery +JavaScript library.

+
+ mocha + + +

This option defines globals exposed by the "BDD" and "TDD" UIs of the +Mocha unit testing framework.

+
+ module + + +

This option informs JSHint that the input code describes an ECMAScript 6 +module. All module code is interpreted as strict mode code.

+
+ mootools + + +

This option defines globals exposed by the +MooTools JavaScript framework.

+
+ node + + +

This option defines globals available when your code is running inside +of the Node runtime environment. Node.js is a +server-side JavaScript environment that uses an asynchronous +event-driven model. This option also skips some warnings that make sense +in the browser environments but don't make sense in Node such as +file-level use strict pragmas and console.log statements.

+
+ nonstandard + + +

This option defines non-standard but widely adopted globals such as +escape and unescape.

+
+ phantom + + +

This option defines globals available when your core is running inside +of the PhantomJS runtime environment. PhantomJS +is a headless WebKit scriptable with a JavaScript API. It has fast and +native support for various web standards: DOM handling, CSS selector, +JSON, Canvas, and SVG.

+
+ prototypejs + + +

This option defines globals exposed by the +Prototype JavaScript framework.

+
+ qunit + + +

This option defines globals exposed by the QUnit unit testing +framework.

+
+ rhino + + +

This option defines globals available when your code is running inside +of the Rhino runtime environment. Rhino +is an open-source implementation of JavaScript written entirely in Java.

+
+ shelljs + + +

This option defines globals exposed by the ShellJS +library.

+
+ typed + + +

This option defines globals for typed array constructors.

More info:

+ +
+ worker + + +

This option defines globals available when your code is running inside +of a Web Worker. Web +Workers provide a +simple means for web content to run scripts in background threads.

+
+ wsh + + +

This option defines globals available when your code is running as a +script for the Windows Script +Host.

+
+ yui + + +

This option defines globals exposed by the YUI +JavaScript framework.

+
+ + +
+ +
+ +
+
+
+ + + + diff --git a/docs/reporters/index.html b/docs/reporters/index.html new file mode 100644 index 0000000..6c39547 --- /dev/null +++ b/docs/reporters/index.html @@ -0,0 +1,157 @@ + + + + + Writing your own JSHint reporter + + + + + + + + + + + + + + + + + + + + +
+
+
+

Writing your own JSHint reporter

+ +

JSHint Reporter is a JavaScript file that accepts raw data from JSHint and +outputs something into the console (or another file, or sends an email; it's +really up to you).

+ +

Here's the simplest reporter, the one that prints OK if JSHint passed the file +and FAIL if it didn't:

+ +
module.exports = {
+  reporter: function (errors) {
+    console.log(errors.length ? "FAIL" : "OK");
+  }
+};
+ +

Each reporter file must expose one function, reporter, that accepts an array +of errors. Each entry of this array has the following structure:

+ +
{
+  file:        [string, filename]
+  error: {
+    id:        [string, usually '(error)'],
+    code:      [string, error/warning code],
+    reason:    [string, error/warning message],
+    evidence:  [string, a piece of code that generated this error]
+    line:      [number]
+    character: [number]
+    scope:     [string, message scope;
+                usually '(main)' unless the code was eval'ed]
+
+    [+ a few other legacy fields that you don't need to worry about.]
+  }
+}
+ +

And a real-world example:

+ +
[
+  {
+    file: 'demo.js',
+    error:  {
+      id: '(error)',
+      code: 'W117',
+      reason: '\'module\' is not defined.'
+      evidence: 'module.exports = {',
+      line: 3,
+      character: 1,
+      scope: '(main)',
+
+      // [...]
+    }
+  },
+
+  // [...]
+]
+ +

If you're still confused, JSHint repository has +an example reporter.

+
+ +
+ +
+
+
+ + + + diff --git a/hack/index.html b/hack/index.html new file mode 100644 index 0000000..4d6f2d3 --- /dev/null +++ b/hack/index.html @@ -0,0 +1,104 @@ + + + + + Contribute + + + + + + + + + + + + + + + + + + + + + + +
+
+
+

This page has moved! You should be automatically redirected momentarily. Click +here if not.

+
+ +
+ +
+
+
+ + + + diff --git a/pages/index.html b/index.html similarity index 90% rename from pages/index.html rename to index.html index 533ee3c..0330ec5 100644 --- a/pages/index.html +++ b/index.html @@ -13,13 +13,9 @@ - {{#if site.dev}} - - - - {{else}} + - {{/if}} + - {{#if site.dev}} - - - - {{ else }} + - {{/if}} + @@ -95,7 +87,7 @@

Metrics