Skip to content

Commit ac102a7

Browse files
authored
feat: validate illformed YAML comments (#180)
Refs: nodejs/node#38324
1 parent ee7cdf8 commit ac102a7

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

remark-lint-nodejs-yaml-comments.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,11 @@ function validateMeta(node, file, meta) {
219219

220220
function validateYAMLComments(tree, file) {
221221
visit(tree, "html", function visitor(node) {
222+
if (node.value.startsWith("<!--YAML\n"))
223+
file.message(
224+
"Expected `<!-- YAML`, found `<!--YAML`. Please add a space",
225+
node
226+
);
222227
if (!node.value.startsWith("<!-- YAML\n")) return;
223228
try {
224229
const meta = yaml.load("#" + node.value.slice(0, -"-->".length));

0 commit comments

Comments
 (0)