grunt-jscs-checker

Grunt task for checking JavaScript Code Style with jscs.

npm install grunt-jscs-checker
1 020 downloads in the last day
5 005 downloads in the last week
24 055 downloads in the last month

grunt-jscs-checker

Task for checking JavaScript Code Style with jscs.

Build Status Dependency Status devDependency Status NPM version

Getting started

This plugin requires Grunt ~0.4.2

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-jscs-checker --save-dev

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

grunt.loadNpmTasks("grunt-jscs-checker");

jscs task

Run this task with the grunt jscs command.

Task targets, files and options may be specified according to the grunt Configuring tasks guide.

Options

Any specified option will be passed through directly to JSCS, plust this plugin has additional options:

config

Type: String Default value: .jscsrc

The path to the jscs configuration file.

If both jscs settings and config option are specified, then they will merge together.

jscs: {
    src: "path/to/files/*.js",
    options: {
        config: ".jscs.json",
        requireCurlyBraces: [ "if" ]
    }
}

Warning: the default value will be changed to null when grunt-jscs-checker reaches v0.5.0.

force

Type: Boolean Default value: false

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

reporter

Type: String Default value: null

Allows you to modify the output. By default it will use a built-in grunt reporter. Set the path to your own custom reporter or to one of the built-in JSCS reporters.

reporterOutput

Type: String Default value: null

Specify a filepath to output the results of a reporter. If reporterOutput is specified then all output will be written to the given filepath instead of printed to stdout.

Usage examples

jscs: {
    main: [ "path/to/files/*.js" ],
    secondary: {
        options: {
            config: ".jscs-secondary.json",
        },
        files: {
            src: [ "path/to/more/files/**/*.js", "my-plugin.js" ]
        }
    },
    ternary: {
        options: {
            requireCurlyBraces: [ "if" ]
        },
        files: {
            src: "happy-hippo.js"
        }
    }
}
npm loves you