This release corrects a packaging issue. It is not expected to modify JSHint's behavior.
for
stmt (56a4379)switch
statements (aa2be10)spyOnProperty
(827237f), closes #3183super
usage to valid forms (8f3f880)void
operand (3f920b5)if
syntax (#3103) (8c6ac87)for-in/of
head LHS as asnmt target (da52ad9)yield
operand (#3011) (b646aea)null
value from errors
array (#3049) (f7eb3d7)y
RegExp flag in ES2015 code (#2999) (a801433)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!
await
keyword in ES6 module code (b1c8d5b)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.
unused
for function-scoped vars (91fa9fc)moz
is set (97dfd90)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!
latedef
shouldn't warn when marking a var as exported (c630994), closes #2662File
and FileList
to browser global variables (7f2a729), closes #2690newcap
within strict mode (acaf3f7)undefined
(0d87919), closes #2699Note 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.
HTMLCollection
to browser environment. (e92d375), closes #2443window.performance
to browser vars (3ff1b05), closes #2461__proto__
when using ES6 (06b5764), closes #2371esnext
(b5ba7d6), closes #2519asi: true
(728c84b), closes #2530func
as a property of state
(3be8d36)ignore
directives as special (f14c262)for
as array comprehensions. (d70876c), closes #1413ignore
directive more consistently (0971608)__proto__
identifier (925a983)strict: func
have precedence over env options. (d138db8)module
option (56c19a5)new.target
(2fbf621)__iterator__
property is deprecated. (7780613)var
inside for (...)
when varstmt: true
(f1ab638), closes #2627esversion
option (cf5a699), closes #2124state
object (678da76)const
declarations in ForIn/Of loops (2b673d9), closes #2334 #2335enforceall
(6afcde4)module
option (290280c)get
and set
as ID properties (2ad235c)singleGroups
(896bf82)futurehostile
option by default (3cbd41f)singleGroups
(6003c83)singleGroups
(bc857f3)delete
(35df49f)doFunction
(06b5d40)futurehostile
(da52aa0)singleGroups
(5fedda6), closes #2064elision
option to relax "Extra comma" warnings (cbfc827), closes #2062[1, , 3, , 5]
)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.
Thanks to Rob Wu, Ryan Cannon, Dave Camp, Amir Livneh, Josh Hoff, Nikolay S. Frantsev, Lapo Luchini, Lukas Domnick for sending patches!
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.
--exclude
argThanks 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!
JSHint 2.1.0 is out. This releases adds support for ES6 class
syntax and
fixes some issues with our parser.
class
syntax.
(#1048)do
statement bodies that are not block
statements.
(#1062)switch
conditionals.
(#1064)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!
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.
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.
Thanks to our newest core contributor, Bernard Pratz, JSHint now has partial
support for Mozilla JavaScript extensions (moz
option) and ES6 (esnext
option):
const
let
blocks and expressionsfor ... of
loopsWe have more patches in queue that add support for classes and other nifty ES6 things. Stay tuned!
.jshintrc
in the directory being linted.
(#833)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.
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!
JSHint 1.0.0 Release Candidate 4 is now out:
/
after ]
.
(#803)predef
when its value is an array,
and not an object. (#800)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.
JSHint 1.0.0 Release Candidate 3 is now out:
new
and debugger
to
appear after a comma. (#793)/*global global:true */
correctly.
(#795)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.
JSHint 1.0.0 Release Candidate 2 is now out:
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!
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.
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)
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.
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:
return o.a =
1
. (#670)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)
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 ...
Thanks to Bernhard K. Weisshuhn, James Allardice, Mike MacCana, Stephen Fry, Steven Olmsted, Leith Abdulla, Eric Promislow and Vlad Gurdiga for submitting patches!