From 79d8ea4e6d8c9770dc376930e175711e528ad79a Mon Sep 17 00:00:00 2001 From: Patrice Chalin Date: Sat, 8 Jun 2024 06:16:02 -0400 Subject: [PATCH] Ignore file-not-found errors --- gulp-src/lint-md.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/gulp-src/lint-md.js b/gulp-src/lint-md.js index 7ceddb24a3d4..0ce4185295d5 100644 --- a/gulp-src/lint-md.js +++ b/gulp-src/lint-md.js @@ -82,7 +82,16 @@ function applyCustomRuleFixesHack(result) { // instead of using mdl's fix mechanism. Object.entries(result).forEach(([filePath, issues]) => { - let fileContent = fs.readFileSync(filePath, 'utf8'); + let fileContent; + try { + fileContent = fs.readFileSync(filePath, 'utf8'); + } catch (err) { + if (err.code === 'ENOENT') { + console.warn(`File not found: ${filePath}, ignoring it.`); + return; + } + throw err; + } // Sort issues by lineNumber in descending order const sortedIssues = issues.sort((a, b) => b.lineNumber - a.lineNumber);