omakasecorp / gulp-jsxcs

JSX code style checks for gulp
MIT License
8 stars 2 forks source link

ANSI colours getting sent through as plain text (at least in windows)? #10

Open Pomax opened 9 years ago

Pomax commented 9 years ago

When running files through gulp-jsxsc in a windows "cmd" terminal, gulp's coulor codes seem to work just fine, but the jscs output has its ANSI colour codes somehow showing up as literal text:

gulp.task('jscs-app', function() {
  var jsxcs = require("gulp-jsxcs");
  var jshint = require('gulp-jshint');
  return gulp.src(jscsSrc)
    .pipe(jsxcs())
    .pipe(jshint.reporter('default'));
});

yields:

screenshot 31

(The top few lines show gulp's colouring working correctly)

If I try to use .pipe(process.stdout) instead of .pipe(jshint.reporter('default')); errors occur that prevent logging entirely, so it's possible the stream is not quite conformant to what stdout data should look like, thus also messing up the default jshint reporter?

agschwender commented 9 years ago

Works fine for me on Ubuntu, so not a super high priority for me, but I'll try to get to it when I can. If it's urgent for you, you're definitely welcome to contribute.

agschwender commented 9 years ago

It's emitting an error, so I don't believe either of those reporters will work. I'm not using jshint to render the output of the task. Here's my gulp task:

// Enforce style rules for js
gulp.task('style:js', function() {
    var jsxcs = require('gulp-jsxcs');
    return gulp.src(paths.js)
        .pipe(jsxcs());
});

Not sure if that will solve the color issues for you, as even when I did run it through the jshint, the console still rendered the colors properly.

Pomax commented 9 years ago

While that works as a stopgap measure, it's not a workable solution if stream needs be sent on for further analysis and/or logging =(

I suspect the fact that the colour codes show as literals, and the fact that node crashes if process.stdout is used instead, are both symptoms of the same underlying problem (something is sending on malformed data over the pipe, or is not yielding the correct stream to send on).