iabw
iabw

Reputation: 1108

Where are JSHint errors logged?

I just started messing around with Grunt. I have a basic implementation running successfully, minifying my code and running JSHint.

It says 0 files lint free, which I've gathered means that all of the files it's checking have lint.

However, I've been googling for an hour, and somehwat incredibly, cannot figure out where the hell these errors are being saved.

Do I need to specify a logfile in the grunt config? I don't see anything like that in the JSHint or grunt documentation.

Gruntfile below, taken pretty much straight from Grunt's "Getting Started". I pulled out qunit because I don't currently have any tests -

module.exports = function(grunt) {
  grunt.initConfig({

    pkg: grunt.file.readJSON('package.json'),

    concat: {
      options: {
        // define a string to put between each file in the concatenated output
        separator: ';'
      },
      dist: {
        // the files to concatenate
        src: ['spin/**/*.js'],
        // the location of the resulting JS file
        dest: 'dist/<%= pkg.name %>.js'
      }
    },

    uglify: {
      options: {
        // the banner is inserted at the top of the output
        banner: '/*! <%= pkg.name %> <%= grunt.template.today("dd-mm-yyyy") %> */\n'
      },
      dist: {
        files: {
          'dist/<%= pkg.name %>.min.js': ['<%= concat.dist.dest %>']
        }
      }
    },

    jshint: {
      // define the files to lint
      files: ['gruntfile.js', 'src/**/*.js', 'test/**/*.js'],
      // configure JSHint (documented at http://www.jshint.com/docs/)
      options: {
          // more options here if you want to override JSHint defaults
          "curly": true,
  "eqnull": true,
  "eqeqeq": true,
  "undef": true,
        globals: {
          jQuery: true,
          console: true,
          module: true
        }
      }
    },

    watch: {
      files: ['<%= jshint.files %>'],
      tasks: ['jshint']
    }

  });

      grunt.loadNpmTasks('grunt-contrib-uglify');
      grunt.loadNpmTasks('grunt-contrib-jshint');
      grunt.loadNpmTasks('grunt-contrib-watch');
      grunt.loadNpmTasks('grunt-contrib-concat');

      grunt.registerTask('test', ['jshint']);

      grunt.registerTask('default', ['jshint', 'concat', 'uglify']);

};

Upvotes: 1

Views: 1523

Answers (1)

hereandnow78
hereandnow78

Reputation: 14434

0 files lint free does not mean that you have files which have errors, it means that zero files are checked!

the jshint-task will output errors to your console (including file, linenumber and column)

thats where you specify your files to check:

files: ['gruntfile.js', 'src/**/*.js', 'test/**/*.js'],

if you change 'gruntfile.js' to 'Gruntfile.js' (case sensitive!) it should check your gruntfile (which you of course already have).

Upvotes: 1

Related Questions