Skip to content

Commit

Permalink
tools: update markdown linter rules
Browse files Browse the repository at this point in the history
Update remark-preset-lint-node to 2.2.0 which includes improved YAML
comment linting for our markdown files.

PR-URL: #38384
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Shingo Inoue <leko.noor@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information
Trott authored and targos committed Sep 4, 2021
1 parent 95b9cc7 commit dfdf6c7
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions tools/lint-md.js
Original file line number Diff line number Diff line change
Expand Up @@ -49714,6 +49714,11 @@ function validateMeta(node, file, meta) {

function validateYAMLComments(tree, file) {
unistUtilVisit(tree, "html", function visitor(node) {
if (node.value.startsWith("<!--YAML\n"))
file.message(
"Expected `<!-- YAML`, found `<!--YAML`. Please add a space",
node
);
if (!node.value.startsWith("<!-- YAML\n")) return;
try {
const meta = jsYaml$2.load("#" + node.value.slice(0, -"-->".length));
Expand Down

0 comments on commit dfdf6c7

Please sign in to comment.