0

I have a large javascript file that appears on every page of my site and defines a number of objects in global scope. On a few pages I have additional scripts that use and extend these objects. I don't want to concatenate them into single large scripts, and I don't want to manually declare which globals are available.

Is there any way to tell JSHint that script X depends on script Y, so look there first for global variables?

Note: I'm aware that I can manually inform JSHint of globals in comments in each file or throughout the project with a .jshintrc file. I am asking for a way to tell JSHint to figure it out automatically, the way it would if script Y were prepended to script X before running JSHint.

Robert
  • 6,660
  • 5
  • 39
  • 62
  • Possible duplicate: http://stackoverflow.com/questions/17709657/how-to-tell-jslint-jshint-what-global-variables-are-already-defined/17709922 – tread Jan 16 '16 at 21:31
  • @surfer190 That question is about manually specifying globals. I'm looking for a way to have JSHint figure out which globals are defined in another file. – Robert Jan 16 '16 at 21:34
  • The above _possible duplcate_ seems the best solution. Closer duplicates: http://stackoverflow.com/questions/27770661/how-to-tell-jshint-to-look-for-definitions-in-another-js-file http://stackoverflow.com/questions/20220634/jslint-import-global-variables-from-another-file – tread Jan 16 '16 at 21:42
  • @surfer190 I'm asking for a way to do it automatically; the best way to do it manually is not an answer. Also my question is not about how to do it using Grunt, and I am asking about JSHint, not JSLint. – Robert Jan 16 '16 at 22:02

0 Answers0