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 <[email protected]>
Reviewed-By: Antoine du Hamel <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Shingo Inoue <[email protected]>
Reviewed-By: James M Snell <[email protected]>
  • 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.