Fix duplicate TODOCS linting rule reports (#57947)
This commit is contained in:
@@ -575,18 +575,22 @@ function getMarkdownLintConfig(errorsOnly, runRules) {
|
||||
for (const searchRule of ruleConfig.rules) {
|
||||
const searchRuleSeverity = getRuleSeverity(searchRule, isPrecommit)
|
||||
if (errorsOnly && searchRuleSeverity !== 'error') continue
|
||||
// Add search-replace rules to frontmatter configuration for rules that make sense in frontmatter
|
||||
// This ensures rules like TODOCS detection work in frontmatter
|
||||
// Rules with applyToFrontmatter should ONLY run in the frontmatter pass (which lints the entire file)
|
||||
// to avoid duplicate detections
|
||||
if (searchRule.applyToFrontmatter) {
|
||||
frontmatterSearchReplaceRules.push(searchRule)
|
||||
} else {
|
||||
// Only add to content rules if not a frontmatter-specific rule
|
||||
searchReplaceRules.push(searchRule)
|
||||
}
|
||||
if (searchRule['partial-markdown-files']) {
|
||||
dataSearchReplaceRules.push(searchRule)
|
||||
}
|
||||
if (searchRule['yml-files']) {
|
||||
ymlSearchReplaceRules.push(searchRule)
|
||||
}
|
||||
// Add search-replace rules to frontmatter configuration for rules that make sense in frontmatter
|
||||
// This ensures rules like TODOCS detection work in frontmatter
|
||||
if (searchRule.applyToFrontmatter) {
|
||||
frontmatterSearchReplaceRules.push(searchRule)
|
||||
}
|
||||
}
|
||||
|
||||
if (searchReplaceRules.length > 0) {
|
||||
|
||||
Reference in New Issue
Block a user