Skip to content

Commit a57894f

Browse files
committed
updated linting script
1 parent af9afba commit a57894f

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

scripts/lint-mdx.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ function checkHeadingStructure(content, filePath) {
128128
let inCodeBlock = false;
129129
let lastHeadingLevel = 0;
130130
let h1Count = 0;
131+
let totalHeadingCount = 0;
131132

132133
for (let i = 0; i < lines.length; i++) {
133134
const line = lines[i];
@@ -141,6 +142,7 @@ function checkHeadingStructure(content, filePath) {
141142
const headingMatch = line.match(/^(#{1,6})\s+/);
142143
if (headingMatch) {
143144
const level = headingMatch[1].length;
145+
totalHeadingCount++;
144146

145147
if (level === 1) {
146148
h1Count++;
@@ -165,6 +167,15 @@ function checkHeadingStructure(content, filePath) {
165167
}
166168
}
167169

170+
// Check for pages with no headings (bad for SEO)
171+
if (totalHeadingCount === 0) {
172+
issues.push({
173+
line: 1,
174+
severity: "warning",
175+
message: "No headings found (at least one heading improves SEO)",
176+
});
177+
}
178+
168179
return issues;
169180
}
170181

0 commit comments

Comments
 (0)