Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

difference between globals and predef in .jshintrc?

Tags:

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/

like image 456
codeboy Avatar asked Mar 21 '14 06:03

codeboy


People also ask

What is Jshintrc file?

JSHint is a program that flags suspicious usage in programs written in JavaScript. The core project consists of a library itself as well as a CLI program distributed as a Node module.


2 Answers

It seems like predef is deprecated and you should use globals instead.

More information here

like image 91
rekarnar Avatar answered Sep 29 '22 14:09

rekarnar


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.

like image 37
Paul Verest Avatar answered Sep 29 '22 14:09

Paul Verest