Skip to content

JSLINT in a web page

douglascrockford edited this page Feb 19, 2013 · 3 revisions

This shows how to use JSLINT in a web page.

Call the JSLINT function, passing in a source text (either a string or an array of strings) and an optional options object.

        JSLINT(source, options);

After JSLINT returns, a data object becomes available that can be used for further analysis and reporting.

        data = JSLINT.data();

The error report contains all of the warnings as a fragment of HTML text. It can be inserted using innerHTML.

        errtext = JSLINT.error_report(data);

The function report contains information about each function and its place in the program as a fragment of HTML text. It can be inserted using innerHTML.

        retext = JSLINT.report(data);

The properties report contains all of the property names used in the report in the form on a /properties/ directive.

        protext = JSLINT.properties_report(JSLINT.property);
Clone this wiki locally