JSLint: control comments (selective ignore)

后端 未结 9 1794
一生所求
一生所求 2020-12-01 06:16

Does JSLint have anything like JavaScript Lint\'s control comments (e.g. /*jsl:fallthru*/) to make it ignore certain passages?

9条回答
  •  既然无缘
    2020-12-01 06:38

    Nothing here has answered this question as far as I am able to tell. The following code still gives me validation errors and I can't get JSLint to accept that I don't have time to correct a working regular expression right now given ACTUAL PRIORITIES.

    The error I'm receiving regards an unescaped '{' and may result in my new, professional team rejecting JSLint as a feasible tool. There appears to be no way to shut it up regarding our efforts to develop more efficiently, which seems problematic.

    /*jslint browser: true, devel: true, todo: true, regexp: true */
    /*global $ */
    /*
        Abstract:
            + This module constitutes a layer of abstraction surrounding our bootstrap dependencies.
            + This module also contains some utility functions (so find a better place for them already!).
        Validation:
            + This module has been validated using JSLint (www.jslint.com).
    */
    var shoelaceModule = (function () {
        'use strict';
        return {
            showModal: function ($target) {
                $target.modal('show');
            },
    
            hideModal: function ($target) {
                $target.modal('hide');
            },
    
            /*jsl:ignore */
            /*ignore jslint start */
            stringFormat: function (format) {
                var args = Array.prototype.slice.call(arguments, 1);
                return format.replace(/{([^{}]*)}/g, function (match, number) {
                    return args[number] !== 'undefined' ? args[number] : match;
                });
            },
            /*ignore jslint end */
            /*jsl:end */
    
            init: function () {
                return this;
            }
        };
    }());
    

提交回复
热议问题