How to tell JSHint to ignore all undefined variables in one file?

前端 未结 4 1852
名媛妹妹
名媛妹妹 2021-02-05 01:27

In Karma tests, there are a lot of global variables and functions, which JSHint complains about (it is integrated into my editor).

How can I tell JSHint to ignore all u

4条回答
  •  一生所求
    2021-02-05 02:06

    Ran into this problem using jshint this afternoon. This following fix worked for me. Instead of using "globals", try using "predef". For example:

    {
      /*
       * RELAXING OPTIONS
       * =================
       */
    
      // Suppress warnings about == null comparisons.
      "eqnull": true,
    
      "predef" : ["describe", "expect", "it", "inject", "beforeEach", "angular"]
    }
    

提交回复
热议问题