Comparing version 1.5.2 to 1.6.0
16
index.js
@@ -25,4 +25,7 @@ 'use strict'; | ||
var configPath = options.configPath; | ||
var shouldFix = options.fix; | ||
delete options.esnext; | ||
delete options.configPath; | ||
delete options.fix; | ||
@@ -61,3 +64,14 @@ if (configPath) { | ||
try { | ||
var errors = checker.checkString(file.contents.toString(), file.relative); | ||
var fixResults; | ||
var errors; | ||
var contents = file.contents.toString(); | ||
if (shouldFix) { | ||
fixResults = checker.fixString(contents, file.relative); | ||
errors = fixResults.errors; | ||
file.contents = new Buffer(fixResults.output); | ||
} else { | ||
errors = checker.checkString(contents, file.relative); | ||
} | ||
var errorList = errors.getErrorList(); | ||
@@ -64,0 +78,0 @@ |
{ | ||
"name": "gulp-jscs", | ||
"version": "1.5.2", | ||
"version": "1.6.0", | ||
"description": "Check JavaScript code style with jscs", | ||
@@ -10,3 +10,3 @@ "license": "MIT", | ||
"email": "sindresorhus@gmail.com", | ||
"url": "http://sindresorhus.com" | ||
"url": "sindresorhus.com" | ||
}, | ||
@@ -38,6 +38,6 @@ "engines": { | ||
"dependencies": { | ||
"gulp-util": "^3.0.0", | ||
"jscs": "^1.8.0", | ||
"gulp-util": "^3.0.4", | ||
"jscs": "^1.12.0", | ||
"object-assign": "^2.0.0", | ||
"through2": "^0.6.1", | ||
"through2": "^0.6.5", | ||
"tildify": "^1.0.0" | ||
@@ -44,0 +44,0 @@ }, |
# 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) | ||
> 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).* | ||
*Issues with the output should be reported on the `jscs` [issue tracker](https://github.com/jscs-dev/node-jscs/issues).* | ||
@@ -12,3 +12,3 @@ | ||
```sh | ||
``` | ||
$ npm install --save-dev gulp-jscs | ||
@@ -20,2 +20,4 @@ ``` | ||
### Reporting | ||
```js | ||
@@ -31,3 +33,18 @@ var gulp = require('gulp'); | ||
### Fixing & reporting | ||
```js | ||
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 | ||
@@ -54,3 +71,3 @@ | ||
### jscs(options) | ||
### jscs([options]) | ||
@@ -61,3 +78,3 @@ #### options | ||
See the jscs [options](http://jscs.info/overview.html#options). | ||
See the `jscs` [options](http://jscs.info/overview.html#options). | ||
@@ -69,5 +86,7 @@ Alternatively you can set the `configPath` *(default: `'.jscsrc'`)* option to the path of a [.jscsrc](http://jscs.info/rules.html) file. | ||
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](http://sindresorhus.com) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
6332
86
87
Updatedgulp-util@^3.0.4
Updatedjscs@^1.12.0
Updatedthrough2@^0.6.5