0

We use gjslinter with Grunt to lint all the js files in our project.

The configuration in Gruntfile.js looks like this:

gjslint: {
    options: {
        flags: ['--disable 220,110,200'],
        reporter: {
            name: 'gjslint_xml',
            dest: '<%= pkg.docs %>/gjslint/gjslint.xml'
        }
    },
    all: {
        src: ['<%= pkg.src %>/assets/js/modules/**', '<%= pkg.src %>/assets/js/lib/jquery/plugins/jquery-hse/**']
    }
}

But when I start the linting it fails:

$ grunt gjslint Running "gjslint:all" (gjslint) task
Warning: Task "gjslint:all" failed. Use --force to continue.

Aborted due to warnings.

Why? Paths should be correct. There are no more error messages or reports. How can I debug this?

Timo Ernst
  • 15,243
  • 23
  • 104
  • 165

1 Answers1

0

I found the solution by following these steps (on Windows 10 here):

  1. Installed Python2.7 https://www.python.org/downloads/
  2. Added Python installation directories C:/Python27 as well as C:/Python27/Scripts to PATH and PYTHONPATH env variables
  3. Installed Google JavaScript Linter by running this in command line:

    pip install https://github.com/google/closure-linter/zipball/master

  4. Changed reporter setting for Grunt:

(Gruntfile.js):

reporter: {
    name: 'console' //report to console
}

Now I am getting proper error messages in console when running grunt gjslint. It showed me that there was a min.js file which had some invalid code. So, I removed it from Gruntfile.js by adding an exception for min files:

src: [
  '<%= pkg.src %>/assets/js/modules/**/*.js',
  '<%= pkg.src %>/assets/js/lib/jquery/plugins/jquery-hse/**/*.js',
  '!<%= pkg.src %>/assets/js/**/*.min.js'
]

This fixed the issue!

Timo Ernst
  • 15,243
  • 23
  • 104
  • 165