From ee54c30251aee559e99e95249001463b87cb0d2d Mon Sep 17 00:00:00 2001 From: Grace Park Date: Tue, 9 Apr 2024 19:15:08 -0700 Subject: [PATCH] Filter out only .md files in data dir to lint (#50072) Co-authored-by: Rachael Sewell --- src/content-linter/scripts/lint-content.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/content-linter/scripts/lint-content.js b/src/content-linter/scripts/lint-content.js index b139806d0d9c..3a7c8cfd2f04 100755 --- a/src/content-linter/scripts/lint-content.js +++ b/src/content-linter/scripts/lint-content.js @@ -327,7 +327,7 @@ function getFilesToLint(paths) { } else if (isInDir(absPath, dataDir)) { if (absPath.endsWith('.yml')) { fileList.yml.push(absPath) - } else { + } else if (absPath.endsWith('.md')) { fileList.data.push(absPath) } } @@ -342,7 +342,12 @@ function getFilesToLint(paths) { function cleanPaths(filePaths) { const clean = [] for (const filePath of filePaths) { - if (path.basename(filePath) === 'README.md') continue + if ( + path.basename(filePath) === 'README.md' || + (!filePath.endsWith('.md') && + !filePath.endsWith('.yml')) + ) + continue const relPath = path.relative(root, filePath) if (seen.has(relPath)) continue seen.add(relPath)