How do I resolve dependencies when linting single javascript files with grunt?-Collection of common programming errors

The jshint options allow you to specify a list of globals that come from other libraries you are using, in your grunt.js file:



    jshint: {
      options: {
        curly: true,
        eqeqeq: true,
        immed: false,
        latedef: true,
        newcap: true,
        noarg: true,
        sub: true,
        undef: true,
        boss: true,
        eqnull: true,
        browser: true
      },

      globals: {
        jQuery: true,
        Backbone: true,
        _: true
      }
    },

note the globals setting at the bottom. This allows JSHint to ignore these variables, but still run your undef: true setting (as shown above).

Originally posted 2013-11-09 23:16:42.