Skip to content

Commit 407b75c

Browse files
authored
Merge pull request TypeStrong#127 from joshpcausey/master
File system lag can cause Invalid source file errors to slip through
2 parents b9bb004 + 271ef9d commit 407b75c

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/IncrementalChecker.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,13 @@ class IncrementalChecker {
238238
try {
239239
this.linter.lint(fileName, undefined, this.linterConfig);
240240
} catch (e) {
241-
if (fs.existsSync(fileName)) {
241+
if (
242+
fs.existsSync(fileName) &&
243+
// check the error type due to file system lag
244+
!(e instanceof Error) &&
245+
!(e.constructor.name === 'FatalError') &&
246+
!(e.message && e.message.trim().startsWith("Invalid source file"))
247+
) {
242248
// it's not because file doesn't exist - throw error
243249
throw e;
244250
}

0 commit comments

Comments
 (0)