lazd / gulp-csslint

CSSLint plugin for gulp
MIT License
74 stars 12 forks source link

piping gulp-cslint.formatter to gulp-csslint.failFormatter suppresses csslint output #65

Open Nightfirecat opened 6 years ago

Nightfirecat commented 6 years ago

Ref: #63 for input/configuration, except gulpfile.js is as follows:

const gulp    = require('gulp'),
      csslint = require('gulp-csslint');

gulp.task('css', function() {
    return gulp.src('test.css')
        .pipe(csslint('.csslintrc'))
        .pipe(csslint.formatter())
        .pipe(csslint.failFormatter());
});

Expected output should be that of the "Actual output" of #63, actual output is as follows:

$ gulp css
[19:25:51] Using gulpfile D:\Documents\git\test\gulpfile.js
[19:25:51] Starting 'css'...
[19:25:51] 'css' errored after 48 ms
[19:25:51] Error in plugin "gulp-csslint"
Message:
    CSSLint failed for test.css
Details:
    domainEmitter: [object Object]
    domain: [object Object]
    domainThrown: false
ghost commented 5 years ago

Fixed this way :

var gulp = require('gulp')
var csslint = require('gulp-csslint')
var reporter = require('gulp-reporter')

gulp.task('lint:css', function() {
    return gulp.src(['theme/css/*.css', '!theme/css/*.min.css'])
        .pipe(csslint('.csslintrc.json'))
        .pipe(csslint.formatter())
        .pipe(reporter())  # that stuff was needed here
        .pipe(csslint.formatter('fail'))
})