Skip to content

Check JavaScript code style with jscs

License

Notifications You must be signed in to change notification settings

LeanKit-Labs/gulp-jscs

 
 

Repository files navigation

gulp-jscs Build Status

Check JavaScript code style with jscs

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

Install

$ npm install --save-dev gulp-jscs

Usage

var gulp = require('gulp');
var jscs = require('gulp-jscs');

gulp.task('default', function () {
	return gulp.src('src/app.js')
		.pipe(jscs());
});

Results

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
	}]
};

API

jscs(options)

options

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.

License

MIT © Sindre Sorhus

About

Check JavaScript code style with jscs

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%