Skip to content

Commit

Permalink
fix(cli): handle missing file entries in project file processing
Browse files Browse the repository at this point in the history
  • Loading branch information
johnsoncodehk committed Jan 4, 2025
1 parent c65906f commit 08d877f
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions packages/cli/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,10 @@ class Project {
while (project.currentFileIndex < project.fileNames.length) {
const i = project.currentFileIndex++;
const fileName = project.fileNames[i];
const fileMtime = fs.statSync(fileName).mtimeMs;
const fileStat = fs.statSync(fileName, { throwIfNoEntry: false });
if (!fileStat) {
continue;
}

addProcessFile(fileName);

Expand All @@ -378,8 +381,8 @@ class Project {

let fileCache = project.cache[fileName];
if (fileCache) {
if (fileCache[0] !== fileMtime) {
fileCache[0] = fileMtime;
if (fileCache[0] !== fileStat.mtimeMs) {
fileCache[0] = fileStat.mtimeMs;
fileCache[1] = {};
fileCache[2] = {};
}
Expand All @@ -388,7 +391,7 @@ class Project {
}
}
else {
project.cache[fileName] = fileCache = [fileMtime, {}, {}, false];
project.cache[fileName] = fileCache = [fileStat.mtimeMs, {}, {}, false];
}

let diagnostics = await linterWorker.lint(
Expand Down

0 comments on commit 08d877f

Please sign in to comment.