Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

gulp-jscs

Package Overview
Dependencies
Maintainers
2
Versions
35
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gulp-jscs

Check JavaScript code style with jscs

  • 1.6.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
5.9K
decreased by-39.41%
Maintainers
2
Weekly downloads
 
Created
Source

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

Reporting

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

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

Fixing & reporting

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

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

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.

Set fix: true if you want jscs to attempt to auto-fix your files. Be sure to pipe to gulp.dest if you use this option.

License

MIT © Sindre Sorhus

Keywords

FAQs

Package last updated on 22 Apr 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc