CI: lint-md task tweaks (#3036)

This commit is contained in:
Patrice Chalin 2023-07-14 09:36:47 -04:00 committed by GitHub
parent 1c245a8cd3
commit caeb53be71
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 7 deletions

View File

@ -2,7 +2,6 @@ const gulp = require('gulp');
const through2 = require('through2');
const markdownlint = require('markdownlint');
const { taskArgs } = require('./_util');
const fs = require('fs');
const defaultGlob = '**/*.md';
const markdownFiles = [
@ -14,12 +13,11 @@ const markdownFiles = [
'!tmp/**',
];
let fileCounter = 0,
let fileCount = 0,
issueCount = 0;
function markdownLintFile(file, encoding, callback) {
// const config = require('../.markdownlint.json');
const config = JSON.parse(fs.readFileSync('./.markdownlint.json'));
const config = require('../.markdownlint.json');
const placeholder = 'lint-md';
const options = {
// We would normally just pass in the file like this:
@ -58,7 +56,7 @@ function markdownLintFile(file, encoding, callback) {
console.log(resultString);
issueCount++;
}
fileCounter++;
fileCount++;
callback(null, file);
});
}
@ -83,8 +81,8 @@ function lintMarkdown() {
.pipe(through2.obj(markdownLintFile))
.on('end', () => {
console.log(
`Processed ${fileCounter} file${
fileCounter == 1 ? '' : 's'
`Processed ${fileCount} file${
fileCount == 1 ? '' : 's'
}, ${issueCount} had issues.`,
);
});