Usage

Interactive use

Drag the ASLint tool link to your toolbar and use it as a regular bookmarklet.

CI/CD integration

Use a small code snippet:

(function(global) {

    var s = document.createElement('script');

    function loaderCallback() {
        // Do actions before ASLint starts
    }

    function resultsCallback(results) {
        console.log(results);
    }

    s.type = 'text/javascript';
    s.async = true;
    s.src = (document.location.protocol === 'https:' ? 'https:' : 'http:') + '//www.aslint.org/api/aslint/loader/loader.js';

    global.aslint = {
        config:  {
            asyncRunner: true,
            reportFormat: { JSON: true },
            resultsCallback: resultsCallback,
            visibleUI: true
        }
    };

    if (typeof s.addEventListener === 'function') {
        s.addEventListener('load', loaderCallback);
    }

    document.body.appendChild(s);
}(this));

If you want to support browsers that do not support addEventListener method (e.g. IE < 9) add before document.body.appendChild(s); following code:

else if (s.readyState) {
    s.onreadystatechange = function () {
        if (/^(complete|loaded)$/.test(this.readyState) === true) {
            s.onreadystatechange = null;
            loaderCallback();
        }
    };
}

Configuration options for ASLint

  • asyncRunner – set to true if rules must be evaluated asynchronously without blocking UI rendering. It is useful when you want to reevaluate rules quite frequently on the content, but you do not want to “freeze” UI.
  • reportFormat – type of results format. Currently only JSON is supported.
  • resultsCallback – a function callback that will be called once all testing will be finished.
  • visibleUItrue if UI of ASLint must be rendered, otherwise false. Useful when ASLint is used in a build pipeline or from developer console.