# gulp-jscs

> Check JavaScript code style with jscs

Latest version **4.1.0** (published 2017-12-31) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install gulp-jscs
pnpm add gulp-jscs
yarn add gulp-jscs
bun add gulp-jscs
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 4.1.0 |
| Published | 2017-12-31 |
| First published | 2013-12-27 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=0.10.0 |
| Dependencies | 4 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 311 |
| Author | Sindre Sorhus |
| Maintainers | sindresorhus, mikesherov |
| Keywords | gulpplugin, jscs, javascript, ecmascript, js, code, style, validate, lint, ast, check, checker |

## Links

- npm: https://www.npmjs.com/package/gulp-jscs
- Repository: https://github.com/jscs-dev/gulp-jscs
- Homepage: https://github.com/jscs-dev/gulp-jscs#readme
- Issues: https://github.com/jscs-dev/gulp-jscs/issues
- npm.io page: https://npm.io/package/gulp-jscs

## Dependencies (4)

- [jscs](https://npm.io/package/jscs.md) ^3.0.4
- [tildify](https://npm.io/package/tildify.md) ^1.0.0
- [through2](https://npm.io/package/through2.md) ^2.0.0
- [plugin-error](https://npm.io/package/plugin-error.md) ^0.1.2

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 4.1.0 (latest) — 2017-12-31
- 4.0.0 — 2016-06-24
- 3.0.2 — 2015-10-27
- 3.0.1 — 2015-10-02
- 3.0.0 — 2015-09-23
- 2.0.0 — 2015-07-28
- 1.6.0 — 2015-04-22
- 1.5.2 — 2015-04-16
- 1.5.1 — 2015-04-08
- 1.5.0 — 2015-04-08
- 1.4.0 — 2015-01-03
- 1.3.1 — 2014-11-26
- 1.3.0 — 2014-11-04
- 1.2.2 — 2014-11-04
- 1.2.1 — 2014-10-21
- … 20 more at https://npm.io/package/gulp-jscs/versions

## README

# gulp-jscs [![Build Status](https://travis-ci.org/jscs-dev/gulp-jscs.svg?branch=master)](https://travis-ci.org/jscs-dev/gulp-jscs)

> Check JavaScript code style with [JSCS](http://jscs.info)

![](screenshot.png)

*Issues with the output should be reported on the JSCS [issue tracker](https://github.com/jscs-dev/node-jscs/issues).*


## Install

```
$ npm install --save-dev gulp-jscs
```


## Usage

### Reporting

```js
const gulp = require('gulp');
const jscs = require('gulp-jscs');

gulp.task('default', () => {
	return gulp.src('src/app.js')
		.pipe(jscs())
		.pipe(jscs.reporter());
});
```

### Fixing

```js
const gulp = require('gulp');
const jscs = require('gulp-jscs');

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

### Reporting & fixing & failing on lint error

```js
const gulp = require('gulp');
const jscs = require('gulp-jscs');

gulp.task('default', () => {
	return gulp.src('src/app.js')
		.pipe(jscs({fix: true}))
		.pipe(jscs.reporter())
		.pipe(jscs.reporter('fail'))
		.pipe(gulp.dest('src'));
});
```


## Results

A `jscs` object will be attached to the file object.  
An example with one error might look like this:

```js
{
	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 [config](http://jscs.info/overview.html#options) should be placed in a `.jscsrc` file.

### jscs([options])

#### options

##### fix

Type: `boolean`  
Default: `false`

Make JSCS attempt to auto-fix your files.  
Be sure to pipe to `gulp.dest` if you use this option.

##### configPath

Type: `string`  
Default: JSCS will search for the config file up to your home directory.

Set the path to the JSCS config file.  
Only use this option when it can't be found automatically.

### jscs.reporter([reporter])

#### reporter

Type: `string`  
Default: `console`

See the JSCS [reporter docs](http://jscs.info/overview#-reporter-r) for supported input.

Can be used multiple times in the same pipeline.

This plugin also ships with some custom reporters:

- `fail` - Emits an error at the end of the stream if there are lint errors.
- `failImmediately` - Emits an error immediately if there are lint errors.


## License

MIT © [Sindre Sorhus](http://sindresorhus.com)

---
_Source: https://npm.io/package/gulp-jscs · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
