difference between globals and predef in .jshintrc?

前端 未结 2 808
轻奢々
轻奢々 2021-01-07 17:41

What the difference and purpose of having both of them in the .jshintrc? When I want to add a variable to be ignored, which one is the best one I should use? Also I can\'t f

2条回答
  •  感动是毒
    2021-01-07 18:14

    At JSHint Doc page http://www.jshint.com/docs/ "predef" is mention for use inside .jshintrc file, wile word "globals" is used only once for inline directive (those that are inside .js files)

    So examples would be :

    • inside .jshintrc file

      "predef" : [ // Extra globals
                   "angular",
      ]
      
    • inside .js files

      /* global app: false */
      

    So it would be better to use different words when doing the same but in different places.

提交回复
热议问题