fix: Only lint staged files on commit
This commit is contained in:
committed by
mrugesh
parent
538e0bbee3
commit
db69c9b071
@ -1,13 +1,11 @@
|
||||
const fs = require('fs-extra');
|
||||
const gulp = require('gulp');
|
||||
const through2 = require('through2');
|
||||
const markdownlint = require('markdownlint');
|
||||
|
||||
const { locale } = require('../config/env.json');
|
||||
const { getChallengesForLang } = require('./getChallenges');
|
||||
const { testedLangs } = require('./utils');
|
||||
const lintYAML = require('./tools/markdown-yaml');
|
||||
const lintConfig = require('./tools/.markdownlintrc.js');
|
||||
const lintMarkdown = require('./tools/lint');
|
||||
|
||||
/**
|
||||
* Tasks
|
||||
@ -32,19 +30,7 @@ function watchFiles() {
|
||||
function lint() {
|
||||
return gulp.src(globLangs(testedLangs()), { read: false }).pipe(
|
||||
through2.obj(function obj(file, enc, next) {
|
||||
const options = {
|
||||
files: [file.path],
|
||||
config: lintConfig,
|
||||
customRules: [lintYAML]
|
||||
};
|
||||
markdownlint(options, function callback(err, result) {
|
||||
const resultString = (result || '').toString();
|
||||
if (resultString) {
|
||||
process.exitCode = 1;
|
||||
console.log(resultString);
|
||||
}
|
||||
next(err, file);
|
||||
});
|
||||
lintMarkdown(file, next);
|
||||
})
|
||||
);
|
||||
}
|
||||
|
Reference in New Issue
Block a user