Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

'debugger' command and JSLint

Google Chrome supports debugger command as a tool to setup a breakpoint in code. How can I hide warnings for the following code in JSLint:

/*globals $, console, */
/*jslint browser:true, white: true */

function test() {

        "use strict";
        debugger;     // JSLint reports the "Unexpected 'debugger'" error
}
like image 970
Martin Vseticka Avatar asked Jan 02 '14 13:01

Martin Vseticka


2 Answers

JSLint has an explicit option to tolerate debugger statements, called debug:

debug: true if debugger statements should be allowed.

You can specify this option via your jslint directive:

/*jslint browser:true, white: true, debug: true */
like image 199
apsillers Avatar answered Sep 29 '22 19:09

apsillers


This error is raised to highlight a lack of convention and possible oversight by the developer.

You can disable it via:

function test() {
    /* ignore jslint start */
    debugger;
    /* ignore jslint end */
}
like image 26
Vlad Bezden Avatar answered Sep 29 '22 19:09

Vlad Bezden