Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed on bootstrap/js/*.js #1

Closed
6aKa opened this issue Jan 3, 2014 · 9 comments
Closed

Failed on bootstrap/js/*.js #1

6aKa opened this issue Jan 3, 2014 · 9 comments

Comments

@6aKa
Copy link

6aKa commented Jan 3, 2014

Task

gulp.task('scripts', function() {
  gulp.src(path.join(app.bower.dir, 'bootstrap/js/*.js'))
    .pipe(tasks.jscs())
    .pipe(gulp.dest(path.join(app.scripts.dst, 'bootstrap')));
});

Error

[gulp] Using file /home/baka/test/Gulpfile.js
[gulp] Working directory changed to /home/baka/test
[gulp] Running 'scripts'...
[gulp] Finished 'scripts' in 65 ms

events.js:72
        throw er; // Unhandled 'error' event
              ^
Error: gulp-jscs:
Operator , should stick to preceding expression at carousel.js :
    41 |  Carousel.DEFAULTS = {
    42 |    interval: 5000
    43 |  , pause: 'hover'
----------^
    44 |  , wrap: true
    45 |  }

Operator , should stick to preceding expression at carousel.js :
    42 |    interval: 5000
    43 |  , pause: 'hover'
    44 |  , wrap: true
----------^
    45 |  }
    46 |

    at /home/baka/test/node_modules/gulp-jscs/index.js:21:14
    at wrappedMapper (/home/baka/test/node_modules/gulp-jscs/node_modules/event-stream/node_modules/map-stream/index.js:76:19)
    at Stream.stream.write (/home/baka/test/node_modules/gulp-jscs/node_modules/event-stream/node_modules/map-stream/index.js:88:21)
    at Stream.ondata (stream.js:51:26)
    at Stream.EventEmitter.emit (events.js:95:17)
    at queueData (/home/baka/test/node_modules/gulp/node_modules/event-stream/node_modules/map-stream/index.js:38:21)
    at queueData (/home/baka/test/node_modules/gulp/node_modules/event-stream/node_modules/map-stream/index.js:51:14)
    at queueData (/home/baka/test/node_modules/gulp/node_modules/event-stream/node_modules/map-stream/index.js:51:14)
    at next (/home/baka/test/node_modules/gulp/node_modules/event-stream/node_modules/map-stream/index.js:68:5)
    at /home/baka/test/node_modules/gulp/node_modules/event-stream/node_modules/map-stream/index.js:77:7

Environment

baka@gentoo ~/test $ npm list --depth=0
test@0.0.1 /home/baka/test
├── gulp@3.2.2
├── gulp-exec@1.0.2
├── gulp-jscs@0.1.3
├── gulp-jshint@1.3.3
├── gulp-jsonlint@0.0.3
├── gulp-load-tasks@0.1.0
└── gulp-util@2.2.5
baka@gentoo ~/test $ bower list
bower check-new     Checking for new versions of the project dependencies..
test#0.0.1 /home/baka/test
├─┬ bootstrap#3.0.3
│ └── jquery#2.0.3
├─┬ jquery.cookie#1.4.0
│ └── jquery#2.0.3
└── videojs#4.3.0
@sindresorhus
Copy link
Contributor

Working as intended. It's supposed to warn you on code formatting violations, which is what it's doing.

@6aKa
Copy link
Author

6aKa commented Jan 4, 2014

I cann't understand this.
Why style checker crashe task. If i run this task from watch... Crash task, watch, gulp.
As for me it's no sense. Style checker: check style, write errors thats all.
I must be able to build project with js style errors or warnings.

@sindresorhus
Copy link
Contributor

Please read the Gulp documentation. You can handle the error if you want.

https://github.com/gulpjs/gulp/wiki#articles-and-recipes

@6aKa
Copy link
Author

6aKa commented Jan 4, 2014

I don't need handle error from checker. I want stream, pipe... Checker should not break stream.
JSHint, example not crached stream. Check and write error. That's all.

gulp.task('build:scripts', function() {
  gulp.src(path.join(app.scripts.src, '**/*.js'))
    .pipe(jshint())
    .pipe(jshint.reporter())
    .pipe(jscs())
    .pipe(gulp.env.production ? tasks.uglify() : tasks.util.noop())
    .pipe(gulp.dest(app.scripts.dst));
});

I read https://github.com/gulpjs/gulp/wiki#articles-and-recipes.
First trick write after dissqussion my issue gulpjs/gulp#82
Second trick has no relation to handle errors.

@sindresorhus
Copy link
Contributor

@contra

@yocontra
Copy link

yocontra commented Jan 5, 2014

@6aKa gulp-jshint is planned to start emitting errors as well. You need to handle the error yourself like this

gulp.task('build:scripts', function() {
  gulp.src(path.join(app.scripts.src, '**/*.js'))
    .pipe(jshint())
    .pipe(jshint.reporter())
    .pipe(jscs().on('error', gutil.log))
    .pipe(gulp.env.production ? tasks.uglify() : tasks.util.noop())
    .pipe(gulp.dest(app.scripts.dst));
});

Keep in mind that gulp is standard node and doesn't have any magic error handling. Plugins will emit errors, you need to handle them.

@yocontra
Copy link

yocontra commented Jan 5, 2014

@sindresorhus You should use the new PluginError stuff from gulp-util to lose the stack on these

@sindresorhus
Copy link
Contributor

@contra Yeah, I'm planning to go through my plugins, but waiting on the streaming changes to be sorted out first.

@yocontra
Copy link

yocontra commented Jan 5, 2014

@sindresorhus We're leaving everything where it is. Basically all that has changed is that if you are a fundamentally buffered library and you want to support streams you can use @nfroidure's new BufferStream module to make it easy

Took quite a clusterfk to get to that decision but I'm confident in it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants