CHANGELOG.md 63 KB

2.9.7 (2018-12-07)

This release corrects a packaging issue. It is not expected to modify JSHint's behavior.

2.9.6 (2018-07-30)

Bug Fixes

  • Add missing global objects for browser env (badc7a4)
  • Add other Fetch spec globals (07bb596), closes #2582
  • Allow closing over immutable bindings (7091685)
  • Allow computed method names in obj literal (a5ff715)
  • Allow empty export and trailing comma (631327e), closes #2567
  • Avoid infinite loop on invalid for stmt (56a4379)
  • Consistently ignore dot-prefixed dirs (8d4317e)
  • Correct impl of built-in bindings (a11d631)
  • Correct interpretation of whitespace (dd06eea)
  • Correct location of reported error (1c434a3)
  • Correct location reported for W043 (1d04868)
  • Correct reporting of var name in list comprehensions (0ff6644)
  • Correct restriction on function name (55aa54e)
  • Correct spelling of Uint8ClampedArray (8df4a32)
  • Create block scope for switch statements (aa2be10)
  • Disallow default values in rest parameters (b420aed)
  • Do not create binding for illegal syntax (9fe8c94)
  • Do not warn about non-ambiguous linebreaks (ab3ab85)
  • Fix "is is" message typos (7993101)
  • Preserve functionality in "legacy" Node.js (2f6ac13)
  • recognize Jasmine global spyOnProperty (827237f), closes #3183
  • Relax restriction on asgnmnt to arguments (0a66710)
  • Remove warning W100 (ff71d3c)
  • Report error for duplicate arrow params (506c7d5)
  • Report error for redeclared generator fns (8896fa3)
  • Restrict "name" of strict mode functions (a554c89)
  • Restrict super usage to valid forms (8f3f880)
  • Restrict IdentifierNames in ES5 code (5995a9f)
  • Tolerate division following closing brace (3aa02db)
  • Tolerate RegExp as void operand (3f920b5)
  • Tolerate whitespace in inline directives (efeb0f8)

Features

  • List outer scoped variables of W083 (d03662c), closes #3211

2.9.5 (2017-06-22)

Bug Fixes

  • Account for hoisting of importing bindings (bd36953)
  • Add onmessage to vars.worker (540ed85)
  • Added missing "Storage" browser variable (8cfe5ad)
  • Avoid crash when peeking past end of prog (c083866)
  • Avoid false positive (44d9e0b)
  • Close synthetic scope for labeled blocks (5f0f789)
  • Fail gracefully on invalid if syntax (#3103) (8c6ac87)
  • Honor "ignore" file when linting STDIN (d4f83a4)
  • Parse for-in/of head LHS as asnmt target (da52ad9)
  • Removed warning message W041 (#3115) (376fa62)
  • Throw W033 instead of E058 when the ; after a do-while stmt is missing (6907cd4)

Features

2.9.4 (2016-10-20)

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)

2.9.3 (2016-08-18)

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

2.9.2 (2016-04-19)

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)

2.9.1 (2016-01-14)

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.

2.9.1-rc3 (2016-01-12)

Bug Fixes

  • Do not require global USD for any envs (3fa9ece)

2.9.1-rc2 (2015-12-22)

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)

2.9.1-rc1 (2015-11-12)

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)

2.9.0 (2015-09-03)

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

  • Add esversion option (cf5a699), closes #2124
  • Add pending to Jasmine's globals (02790b9), closes #2154
  • Add Window constructor to browser vars (7f5806f), closes #2132
  • Option to assume strict mode (8de8247), closes #924
  • Support multiple files in the exclude option (bd4ec25)

2.8.0 (2015-05-31)

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

2.7.0 (2015-04-10)

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

2.6.3 (2015-02-28)

Bug Fixes

  • parse trailing comma in ObjectBindingPattern (7a2b713), closes #2220

2.6.2 (2015-02-28)

Bug Fixes

  • Disable futurehostile option by default (3cbd41f)
  • Make let variables in the closure shadow predefs (cfd2e0b)

2.6.1 (2015-02-27)

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

2.6.0 (2015-01-21)

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])

2.5.11 (2014-12-18)

2.5.10 (2014-11-06)

2.5.9 (2014-11-06)

2.5.8 (2014-10-29)

2.5.7 (2014-10-28)

2.5.6 (2014-09-21)

2.5.5 (2014-08-24)

2.5.4 (2014-08-18)

2.5.3 (2014-08-08)

2.5.2 (2014-07-05)

2.5.1 (2014-05-16)

2.5.0 (2014-04-02)

2.4.4 (2014-02-21)

2.4.3 (2014-01-26)

2.4.2 (2014-01-21)

2.4.1 (2014-01-03)

2.4.0 (2013-12-25)

2.3.0 (2013-10-21)

2.2.0 (2013-10-18)

2.1.11 (2013-09-20)

2.1.10 (2013-08-15)

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!

2.1.9 (2013-08-02)

2.1.8 (2013-08-01)

2.1.7 (2013-07-29)

2.1.6 (2013-07-29)

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!

2.1.5 (2013-07-27)

2.1.4 (2013-06-24)

2.1.3 (2013-06-03)

2.1.2 (2013-05-22)

2.1.1 (2013-05-21)

2.1.0 (2013-05-21)

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!

2.0.1 (2013-05-08)

2.0.0 (2013-05-08)

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!

1.1.0 (2013-03-06)

1.0.0 (2013-01-30)

1.0.0-rc4 (2013-01-18)

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.

1.0.0-rc3 (2013-01-02)

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.

1.0.0-rc2 (2012-12-31)

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!