diff --git a/src/rules/lib/parseRuleDescription.ts b/src/rules/lib/parseRuleDescription.ts index 900aa51..f36d79e 100644 --- a/src/rules/lib/parseRuleDescription.ts +++ b/src/rules/lib/parseRuleDescription.ts @@ -1,13 +1,14 @@ import fs from 'fs'; -import { ValidationError } from '../../errors'; import { join } from 'path'; export default function parseRuleDescription(id: string): string { const content = fs.readFileSync(join(__dirname, `../../../doc/rules/${id}.md`), 'utf-8'); - const propertiesContent = content.match(/---\n((?:.*\n)+)---\n((?:.*\n)+?)###/); + const propertiesContent = content.match(/---\n((?:.*\n)+)---\n((?:.*\n)+?)##?#?/); if (!propertiesContent) { - throw new ValidationError(`Unable to read description for rule "${id}".`); + // This is probably a new doc that doesn't have front matter yet. + // It's all description. + return content; } return propertiesContent[2].replace(/\n/g, ' ').trim();