remarkjs / gulp-remark

Deprecated Gulp plugin for remark — please use npm scripts and the like
9 stars 3 forks source link

`option.frail` not working #6

Closed alexander-akait closed 8 years ago

alexander-akait commented 8 years ago

@denysdovhan https://github.com/denysdovhan/gulp-remark/issues/5#issuecomment-190766723

Gulp not exit with code > 0

'use strict';

var options = require('../options');
var taskConfig = options.get('tasks.remarkLint');

if (!taskConfig.enable) {
    return;
}

var gulp = require('gulp');
var gulpPlumber = require('gulp-plumber');
var gulpRemark = require('gulp-remark');
var gulpRemarkLint = require('remark-lint');
var definingConfiguration = require('../lib/defining-configuration');
var path = require('path');
var fs = require('fs');
var remarkLintOptions = JSON.parse(fs.readFileSync(path.join(process.cwd(), '.remarkrc'), 'utf8'));

function remarkLintTask() {
    var config = this.config;

    return gulp
        .src(config.paths.src.globs, config.paths.src.options)
        .pipe(gulpPlumber(config.options.plumber))
        .pipe(gulpRemark({detectRC: false, frail: true}).use(gulpRemarkLint, remarkLintOptions.plugins.lint));
}

gulp.task('remarkLint', definingConfiguration(taskConfig, remarkLintTask));

module.exports = remarkLintTask;

Output:

/some/path/to/README.md
       27:3  warning  Incorrect indentation before bullet: remove 2 spaces  list-item-bullet-indent
       27:3  warning  Incorrect indentation before bullet: remove 2 spaces  list-item-bullet-indent

⚠ 2 warnings
[18:45:21] Finished 'remarkLint' after 7.03 s
denysdovhan commented 8 years ago

Confirmed. Fixing this…

denysdovhan commented 8 years ago

@wooorm I can fix it only in gulp-remark, but maybe better to throw error in remark, here? Then I will check it in gulp-plugin and pass to gulp?

alexander-akait commented 8 years ago

@denysdovhan may be look how another gulp plugins work (example gulp-eslint)

wooorm commented 8 years ago

@denysdovhan, that’s not possible, it uses a callback exactly because we don’t want to throw errors!

Instead, check the second value for done to detect if remark has “failed”, which isn’t handled yet.

denysdovhan commented 8 years ago

@wooorm okay, I've got it. Thank you for help.

denysdovhan commented 8 years ago

Done. @evilebottnawi please check.