Skip to content
Grunt integration of google closure linter
JavaScript Python
Branch: master
Clone or download

Latest commit

Fetching latest commit…
Cannot retrieve the latest commit at this time.


Type Name Latest commit message Commit time
Failed to load latest commit information.


Sorry for not working on this project for a long time. I will not further support this project, but I still leave it accessible to those, who use grunt-closure-linter in theri projects. If anyone is interested in taking over the project, let me know!


Google closure linting

Getting Started

This plugin requires Grunt ~0.4.3

If you haven't used Grunt before, be sure to check out the Getting Started guide, as it explains how to create a Gruntfile as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:

npm install grunt-closure-linter --save-dev

One the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:


The "closureLint" and "closureFixStyle" tasks


In order to run the "closureLint" or "closureFixStyle" tasks you've to globally install the Closure Linter. For advanced usage you can also directly reference the Closure Linter folder. In this case you might need a wrapper for the and scripts or otherwise python will fail with an import error.

If you haven't installed the python setuptools yet, you may install them with this command:

wget -O - | sudo python

Install the Closure Linter (download) with this command:

cd path/to/closure_linter  # extracted from the closure_linter-latest.tar.gz
sudo python install

# Test installation
gjslint  # Should echo "0 files checked, no errors found."


In your project's Gruntfile, add a section named closureLint and/or closureFixStyle to the data object passed into grunt.initConfig().

Use the command attribute to point to a specific command if yours has not the default name.

  closureLint: {
    options: {
      // [OPTIONAL] Use strict mode (default is false).
      strict: true
      src: [ 'app/scripts/controllers/**',
             'app/scripts/app.js' ]
      // Also possible:
      // src: [ 'app/scripts' ]
    // Example configuration using the jslint converter
      options: {
      	// [OPTIONAL] Use strict mode (default is false).
      	strict: true,
      	// Converts linter results into XML format
        converter: 'jslint'
      src: [ 'app/scripts/controllers/**',
             'app/scripts/app.js' ],
      dest: 'gjslint.log' // Writes linter result into dest file
  closureFixStyle: {
    options: {
      // [OPTIONAL] Use strict mode (default is false).
      strict: true
      src: [ 'app/scripts/controllers/**',
             'app/scripts/app.js' ]



Type: string Default value: /usr/local/bin

Path to the Closure Linter folder.


Type: string

Tool file to be executed. In case of closureLinter task this defaults to gjslint and in case of closureFixStyle this defaults to fixjsstyle. You can also set e.g. as tool file in case you're directly referencing the Closure Linter folder. This option makes only sense in combination with closureLinterPath.


Type: Boolean Default value: true

Pipe output to stdout.


Type: Boolean Default value: true

Pipe errors to stderr.


Type: Boolean Default value: true

Fail task on errors.


Type: Boolean Default value: false

Use strict mode.


Type: number Default value: 80

Set the max line length.


Type: string Default value: 'closure'

Converter type. Possible values are: 'closure', 'jslint'. In case of jslint the linter result will be converted into a XML format and will be written to the dest file (see above example configuration for closureFixStyle.


In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using Grunt.

Release History

0.2.0 Rework of the Grunt Closure Linter

0.0.1 Initial revision

You can’t perform that action at this time.