doyoe / css-handbook

CSS参考手册
http://css.doyoe.com
Apache License 2.0
1.54k stars 313 forks source link

[构建] Add more linters #137

Open gucong3000 opened 7 years ago

gucong3000 commented 7 years ago

很高兴见到ghooks被加入到项目中来,我想为本项目安装更多的linter,@doyoe ,请确认一下哪些是你愿意接受的。

gucong3000 commented 7 years ago

关键的代码时这样的:


    return gulp.src(globs, {
        stripBOM: false,
        base: process.cwd()
    })

        // 排除二进制文件
        .pipe(filter(file => !(file && file.isBuffer() && fileType(file.contents))))

        // 排除`.gitignore`中定义的文件
        .pipe(gitignore())

        // htmlhint
        .pipe(gulpif(file => /\.html?$/i.test(file.path), htmlhint(config)))

        // eslint
        .pipe(gulpif(file => /\.jsx?$/i.test(file.path), eslint(config)))

        // stylelint
        .pipe(gulpif(file => /\.s?css$/i.test(file.path), postcss([stylelint(config)])))

        // editorconfig
        .pipe(fix ? eclint.fix() : eclint.check())

        // 错误汇报
        .pipe(fix ? gulp.dest(".") : reporter());