JSHint W117 inline ignore

JSHint override without observing.

[Exit]: [L59: C38] W117: "warning" not defined.

[Exit]: / * jshint -W117 * / alert ("failed to load browse data .."); / * jshint + W117 * /

- Actual line of code:

$scope.example.$get(
    function(data){
       $scope.data =  //do something;
    }, function(message){
        /*jshint -W117 */alert("failed..");/*jshint +W117 */
});

I use them for other warnings, but W117 seems to be ignored.

+4
source share
3 answers

Try using them on a separate line.

/* jshint -W117 */
alert("failed..");
/* jshint +W117 */

Another option to disable the warning is to add this at the top of the file.

/* global alert */
+4
source
alert("failed.."); //jshint ignore:line
+1
source

.jshintrc :

{
  "globals": {
    "alert": false
  }
}

The globals parameter says that this variable is global, defined elsewhere, and the value falsemeans that it should not be redefined.

0
source

Source: https://habr.com/ru/post/1532129/


All Articles