I want to split the application logic into several Javascript files for the convenience and friendliness of the developer, stored in the / src folder. These files must be lithified and combined in /dist/app.js during the build process. I use grunt for my build process, as it already comes with convenient lint and concat tasks.
+
| - grunt.js
| - readme
| -vendors
| -backbone.js
| - src
| - core.js
| - user.js
| - dist
| -app.js
I am facing an annoying problem. I use backbone.js to structure the application, and most of my source files start with defining models, extending Backbone.Model . When dragging and dropping these files, JSHint complains that the Backbone is undefined and correct, so the main trunk is outside in its own directory. By including all the necessary scripts in the correct order, I assume this is done in html. Each individual source file should know only about itself.
I know that I can suppress these undefined warnings by setting the lint undef flag in grunt.js false , but I want to keep it true to be warned about other undefined variables in my application, as this is a regular pointer to typos. Is there a clean way to tell grunts (or lint) which files to include before simulating them? Am I doing something wrong with my build process or application architecture? Or is it just what I need to live with?
timkg
source share