Skip to content

Commit

Permalink
fix: add validation for missing frontmatter in validateBlogs function
Browse files Browse the repository at this point in the history
  • Loading branch information
JeelRajodiya committed Jan 5, 2025
1 parent b94707f commit bf6f225
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions scripts/markdown/check-markdown.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ function validateBlogs(frontmatter: FrontMatter) {
const requiredAttributes = ['title', 'date', 'type', 'tags', 'cover', 'authors'];
const errors = [];

if (!frontmatter) {
errors.push('Frontmatter is missing');

Check warning on line 48 in scripts/markdown/check-markdown.ts

View check run for this annotation

Codecov / codecov/patch

scripts/markdown/check-markdown.ts#L48

Added line #L48 was not covered by tests
}

// Check for required attributes
requiredAttributes.forEach((attr) => {
if (!Object.prototype.hasOwnProperty.call(frontmatter, attr)) {
Expand Down

0 comments on commit bf6f225

Please sign in to comment.