Skip to content

Commit

Permalink
Ignore file-not-found errors
Browse files Browse the repository at this point in the history
  • Loading branch information
chalin committed Jun 8, 2024
1 parent 122d31c commit 79d8ea4
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion gulp-src/lint-md.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 79d8ea4

Please sign in to comment.