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 find 'predef' in http://www.jshint.com/docs/options/
Asked
Active
Viewed 9,268 times
2 Answers
17
It seems like predef
is deprecated and you should use globals
instead.
More information here
-
7well, [this](https://github.com/jshint/jshint/pull/1178) pull request does imply it has been deprecated, but [jshint doc](http://www.jshint.com/docs/) is still using `predef` in the example. – codeboy Apr 30 '14 at 08:07
5
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.

Paul Verest
- 60,022
- 51
- 208
- 332
-
For inline comment in js files, should it be `/* globals app: false */` (plural form) or `/* global app:false */` (singular form). [JSHint doc](http://jshint.com/docs/options/#globals) did not provide a specific example for the inline configuration for this option. – Yiling Oct 28 '15 at 20:28
-
globals can also be used in .jshintrc, So an difference in where they are used is stricly user preferance. global is a typo anywhere. – wheredidthatnamecomefrom Nov 15 '21 at 18:39