title: How do I resolve dependencies when linting single javascript files with grunt?
body: <p>I want to separate my application logic into multiple Javascript files for sanity and developer friendliness, stored in the /src folder. These files should be linted and concatenated into /dist/app.js during the build process. I am using grunt for my build process, as it already comes with handy lint and concat tasks.</p>
  
  <pre>
  
      +
      |- grunt.js
      |- readme
      |-vendors
         |-backbone.js
      |- src
         |- core.js
         |- user.js
      |- dist
         |-app.js
  
  </pre>
  
  <p>I am running into an annoying problem. I use backbone.js for application structure, and most of my source files start by defining models by extending <strong>Backbone.Model</strong>. When linting these files, JSHint complains that Backbone is not defined, and rightly so - backbone resides outside in its own directory. Including all necessary scripts in the right order is something I assume is done in the html. Each individual source file should only know about itself.</p>
  
  <p>I know that I can suppress these <strong>undefined</strong> warnings by setting lint's <strong>undef</strong> flag in grunt.js to <strong>false</strong> but I want to keep it set to <strong>true</strong> in order to be warned about other undefined variables in my application, as it is a common pointer to typos. Is there a clean way to tell grunt (or lint) what files to include prior to linting them? Am I doing something wrong with my build process, or with my application architecture? Or is this simply something I have to live with?</p>