Integrated support for JavaScript linting and syntax checking using JSLint by Douglas Crockford has been added to CSE HTML Validator v11.0 and above (but is not in the lite edition).

To distinguish JSLint messages from other messages, the string "[JSLint]" is prepended to the JSLint messages.

NOTE: The default JavaScript linting tool is now JSHint because many developers consider it to be more practical because it has more configurable options and is less strict than JSLint.

NOTE: JSLint code quality checking requires jslint.js, which is written in JavaScript and included with CSE HTML Validator. As of v15.0116, Node.js is used to run JSLint instead of cscript.exe. This allows newer versions of JSLint to be used.

WARNING: JSLint will hurt your feelings. Side effects may include headache, irritability, dizziness, snarkiness, stomach pain, defensiveness, dry mouth, cleaner code, and a reduced error rate.

JSLint Options

Enable JSLint lint messages in validation results - Check this box to enable JavaScript linting and syntax checking with JSLint during validations and to display the results in the validation messages. Checking this option will result in slightly slower validation times because JSLint must be run. This option is not enabled by default.

Improve JSLint lint messages - Check this option to enable CSE HTML Validator to make changes to JSLint message output to try to make the messages more clear and easier to understand for the average web developer. Message IDs may also be added to some messages so that the message can be disable or its type changed. If you want unaltered JSLint output, then uncheck this option. This option is enabled by default.

Text Edit Options

Options - These options used when running JSLint. The default for v16.0+ is "--browser=true --devel=true --maxerr=30 --white=true --this=true", not including the double quotes.

Registry Options

Some options that are not changeable here can be changed in the registry under the key "HKEY_CURRENT_USER\Software\AI Internet Solutions\CSE HTML Validator v4\Validator DLL\JSLint". For example, the timeout can be changed by changing the "TimeoutSeconds" value.

JSLint Configuration Tips

Various JSLint options can be set in individual script files using special /*jslint*/ comments in JavaScript code. For more information, visit the link at the bottom of this page.

To allow standard browser globals (like document, event, history, screen, etc, but not self or window), browser can be set to true. Use this for the Options (add other options you may want): --browser=true

To allow browser globals (like alert, console, etc) that are useful in development, devel can be set to true. Use this for the Options (add other options you may want): --devel=true

To allow specific globals, like '$' for jQuery, add this comment to the top of a JavaScript file: /*global $ */ or (if specifying more than one global): /*global $, global1, global2, etc */

To tolerate messy whitespace, white can be set to true. Use this for the Options (add other options you may want): --white=true

JSLint Notes

CSE HTML Validator Standard v16.0 and above include a newer build of JSLint with better support for the sixth edition of ECMAScript [ES6]. It also drops some options that were supported by older versions of JSLint.

JSLint no longer works on HTML documents with embedded JavaScript, and the JSLint options related to such (like fragment and on) have been removed. This functionality was removed by the JSLint developer because of the developer's reasoning that it was encouraging a bad practice. Instead it is recommended that JavaScript not be inserted into HTML documents; JavaScript should be separated into its own files, which also allows for additional benefits from minification, compression, and caching.

JSLint is not developed or maintained by AI Internet Solutions LLC. AI Internet Solutions LLC only provides an interface to JSLint. Therefore, only bugs or problems with the JSLint interface (but not JSLint itself) should be reported to AI Internet Solutions LLC.

Consider only checking JavaScript files that you have control over.

Options Removed in Newer Versions of JSLint

These options used to be supported in older versions of JSLint included with CSE HTML Validator v15.0 and below but are currently no longer available in the newer version of JSLint included with CSE HTML Validator v16.0. They are listed here for reference purposes but should not be used.

To turn off indentation, indent can be set to 0. Use this for the Options (add other options you may want): --indent=0

To go against the convention and allow non-constructor functions to begin with uppercase letters to eliminate the "Missing 'new'" messages, add this option: --newcap=true

To allow the ++ and -- operators, plusplus can be set to true. Use something like this for the Options (add other options you may want): --plusplus=true

For stricter checking, try adding these options (or changing there values if already there): --unparam=false --plusplus=false

More Information

For more information, including information about available options, please visit the JSLint: The JavaScript Code Quality Tool page or the JSLint Community.