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);