gulp-jscs

Check JavaScript code style with jscs

gulp-jscs

Check JavaScript code style with jscs

Issues with the output should be reported on the jscs issue tracker.

$ npm install --save-dev gulp-jscs
var gulp = require('gulp');
var jscs = require('gulp-jscs');
 
gulp.task('default', function () {
    return gulp.src('src/app.js')
        .pipe(jscs());
});

A jscs object will be attached to the file object which can be used for custom error reporting. An example with one error might look like this:

{
    success: false,  // or true if no errors 
    errorCount: 1,   // number of errors in the errors array 
    errors: [{       // an array of jscs error objects 
        filename: 'index.js',  // basename of the file 
        rule: 'requireCamelCaseOrUpperCaseIdentifiers',  // the rule which triggered the error 
        message: 'All identifiers must be camelCase or UPPER_CASE',  // error message 
        line: 32,  // error line number 
        column: 7  // error column 
    }]
};

Type: object

See the jscs options.

Alternatively you can set the configPath (default: '.jscsrc') option to the path of a .jscsrc file.

Set esnext: true if you want your code to be parsed as ES6 using the harmony version of the esprima parser.

MIT © Sindre Sorhus