-
Notifications
You must be signed in to change notification settings - Fork 191
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into feat/database-metrics-yaml
- Loading branch information
Showing
9 changed files
with
79 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
const gulp = require("gulp"); | ||
const through2 = require("through2"); | ||
const markdownlint = require("markdownlint"); | ||
const yaml = require("js-yaml"); | ||
const fs = require("fs"); | ||
|
||
let fileCount = 0, | ||
issueCount = 0; | ||
|
||
function markdownLintFile(file, encoding, callback) { | ||
const config = yaml.load(fs.readFileSync("./.markdownlint.yaml", "utf8")); | ||
const options = { | ||
files: [file.path], | ||
config: config, | ||
}; | ||
|
||
markdownlint(options, function (err, result) { | ||
if (err) { | ||
console.error("ERROR occurred while running markdownlint: ", err); | ||
return callback(err); | ||
} | ||
|
||
const _resultString = (result || "").toString(); | ||
// Result is a string with lines of the form: | ||
// | ||
// <file-path>:\s*<line-number>: <ID-and-message> | ||
// | ||
// Strip out any whitespace between the filepath and line number | ||
// so that tools can jump directly to the line. | ||
const resultString = _resultString | ||
.split("\n") | ||
.map((line) => line.replace(/^([^:]+):\s*(\d+):(.*)/, "$1:$2:$3")) | ||
.join("\n"); | ||
if (resultString) { | ||
console.log(resultString); | ||
issueCount++; | ||
} | ||
fileCount++; | ||
callback(null, file); | ||
}); | ||
} | ||
|
||
function lintMarkdown() { | ||
const markdownFiles = ["**/*.md", "!**/node_modules/**", "!**/.github/**"]; | ||
|
||
return gulp | ||
.src(markdownFiles) | ||
.pipe(through2.obj(markdownLintFile)) | ||
.on("end", () => { | ||
console.log( | ||
`Processed ${fileCount} file${ | ||
fileCount == 1 ? "" : "s" | ||
}, ${issueCount} had issues.`, | ||
); | ||
}); | ||
} | ||
|
||
lintMarkdown.description = `Run markdownlint on all '*.md' files.`; | ||
|
||
gulp.task("lint-md", lintMarkdown); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,15 @@ | ||
{ | ||
"devDependencies": { | ||
"gulp": "^4.0.2", | ||
"js-yaml": "^4.1.0", | ||
"markdown-link-check": "3.10.3", | ||
"markdown-toc": "^1.2.0", | ||
"markdownlint-cli": "0.31.0" | ||
"markdownlint": "^0.29.0", | ||
"markdownlint-cli": "0.31.0", | ||
"prettier": "^3.0.0", | ||
"through2": "^4.0.2" | ||
}, | ||
"prettier": { | ||
"proseWrap": "preserve" | ||
} | ||
} |