From f5808cb51529174a67b4938223f06435ad6d5118 Mon Sep 17 00:00:00 2001 From: Milos Djermanovic Date: Mon, 21 Nov 2022 12:01:10 +0100 Subject: [PATCH] chore: fix rule doc headers check (#16564) --- Makefile.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Makefile.js b/Makefile.js index 64b52457943..e85514db9d9 100644 --- a/Makefile.js +++ b/Makefile.js @@ -15,6 +15,7 @@ const checker = require("npm-license"), fs = require("fs"), glob = require("glob"), marked = require("marked"), + matter = require("gray-matter"), markdownlint = require("markdownlint"), os = require("os"), path = require("path"), @@ -707,7 +708,8 @@ target.checkRuleFiles = function() { const basename = path.basename(filename, ".js"); const docFilename = `docs/src/rules/${basename}.md`; const docText = cat(docFilename); - const docMarkdown = marked.lexer(docText, { gfm: true, silent: false }); + const docTextWithoutFrontmatter = matter(String(docText)).content; + const docMarkdown = marked.lexer(docTextWithoutFrontmatter, { gfm: true, silent: false }); const ruleCode = cat(filename); const knownHeaders = ["Rule Details", "Options", "Environments", "Examples", "Known Limitations", "When Not To Use It", "Compatibility"];