How to disable the warning 'define' is not defined using JSHint and RequireJS

前端 未结 8 1624
温柔的废话
温柔的废话 2020-11-29 19:21

I uses RequireJS AMD in my project. When i run jshint on my project, it throws error like

In AMD Scripts

 \'define\' is not defined.
<
8条回答
  •  有刺的猬
    2020-11-29 19:45

    Just to expand a bit, here's a .jshintrc setup for Mocha:

    {
      ....
      "globals"   : {
        /* MOCHA */
        "describe"   : false,
        "it"         : false,
        "before"     : false,
        "beforeEach" : false,
        "after"      : false,
        "afterEach"  : false
      }
    }
    

    From the JSHint Docs - the false (the default) means the variable is read-only.

    If you are defining globals only for a specific file, you can do this:

    /*global describe, it, before, beforeEach, after, afterEach */
    

提交回复
热议问题