tillarnold/grunt-jsxhint

jsxhint does not seem to be working

arianf opened this issue · 1 comments

My grunt file is super simple:

module.exports = function(grunt) {

  grunt.loadNpmTasks('grunt-jsxhint');

  /* Project configuration */
  grunt.initConfig({
    options: {
      jshintrc: '.jshintrc',
      ignores: [],
      additionalSuffixes: ['.js', '.ios.js']
    },
    jshint: {
      all: ['./app/index.ios.js']
    }
  });

  /* Test Tasks */
  grunt.registerTask('test', ['jshint']);
};

When I do a grunt test, I get the following errors.

screen shot 2015-04-08 at 3 14 29 pm

But when I installed npm install -g jsxhint I can do a test and see the proper result

screen shot 2015-04-08 at 3 12 40 pm

I figured out what was wrong with my Gruntfile.

You need to load the task in: grunt.loadNpmTasks('grunt-jsxhint');

After grunt.initConfig({}) has been set, or else it won't be able to pull any grunt config properties

This would look like this:

module.exports = function(grunt) {

  /* Project configuration */
  grunt.initConfig({
    options: {
      jshintrc: '.jshintrc',
      ignores: [],
      additionalSuffixes: ['.js', '.ios.js']
    },
    jshint: {
      all: ['./app/index.ios.js']
    }
  });

  grunt.loadNpmTasks('grunt-jsxhint');

  /* Test Tasks */
  grunt.registerTask('test', ['jshint']);
};