Skip to content

Latest commit

 

History

History
114 lines (89 loc) · 2.08 KB

README.md

File metadata and controls

114 lines (89 loc) · 2.08 KB

build status

grunt-coffeelint

Lint your CoffeeScript with CoffeeLint.

Installation

Install npm package, next to your project's Gruntfile.js file:

npm install git+https://git@github.com/gobie/grunt-coffeelint.git

Add this line to your project's Gruntfile.js:

grunt.loadNpmTasks('grunt-coffeelint');

Options

A few additional options are supported:

force

Type: Boolean Default value: false

Set force to true to report CoffeeLint errors but not fail the task.

rules

Type: Array Default value: []

List of npm packages to be loaded as custom rules. They have to be requirable so included in project's package.json or available as global package.

Configuration

coffeelint is a multitask, so you can use it similary to lint, watch etc...

grunt.initConfig({
    ...
    coffeelint: {
      app: ['app/*.coffee', 'scripts/*.coffee']
    },
    ...
});

Options per target

grunt.initConfig({
    ...
    coffeelint: {
      app: ['app/*.coffee', 'scripts/*.coffee'],
      tests: {
        files: {
          src: ['tests/*.coffee']
        },
        options: {
          'no_trailing_whitespace': {
            'level': 'error'
          }
        }
      }
    },
    ...
});

Global - default options

grunt.initConfig({
    ...
    coffeelint: {
      options: {
        'no_trailing_whitespace': {
          'level': 'error'
        }
      }
    },
    ...
});

Custom rules

grunt.initConfig({
    ...
    coffeelint: {
      rules: ['coffeelint-complex-conditions']
    },
    ...
});

Loading external config

grunt.initConfig({
    ...
    coffeelint: {
      options: {
        configFile: 'coffeelint.json'
      }
    },
    ...
});

Task options take precedence over configFile options.

For available options see coffeelint homepage.