globals和predef在.jshintrc中的区别?

他们在.jshintrc中有什么不同和目的? 当我想添加一个被忽略的variables,哪一个是我应该使用的最好的一个? 另外,我无法在http://www.jshint.com/docs/options/中find“predef”

看起来像predef已被弃用,你应该使用globals

更多信息在这里

在JSHint Doc页面http://www.jshint.com/docs/中提到"predef" .jshintrc "predef"是在.jshintrc文件中使用的,对于内联指令,只使用一次“globals”(在.js文件中)

所以例子是:

  • 里面的.jshintrc文件

     "predef" : [ // Extra globals "angular", ] 
  • 里面的.js文件

     /* global app: false */ 

因此,在不同的地方做同样的事情时最好用不同的词语。

Interesting Posts