diff --git a/prettier/main.ts b/prettier/main.ts index a5e11e79fd..f4a2232ccb 100755 --- a/prettier/main.ts +++ b/prettier/main.ts @@ -107,8 +107,8 @@ async function checkFile( const text = await readFileIfExists(filename); if (!text) { - // The file is deleted. Skip. - return; + // The file is empty. Skip. + return true; } const formatted = prettier.check(text, { diff --git a/prettier/main_test.ts b/prettier/main_test.ts index 0d60150803..10ad79e36b 100644 --- a/prettier/main_test.ts +++ b/prettier/main_test.ts @@ -48,7 +48,11 @@ async function clearTestdataChanges(): Promise { test(async function testPrettierCheckAndFormatFiles() { await clearTestdataChanges(); - const files = [join(testdata, "0.ts"), join(testdata, "1.js")]; + const files = [ + join(testdata, "0.ts"), + join(testdata, "1.js"), + join(testdata, "2.ts") + ]; var { code, stdout } = await run([...cmd, "--check", ...files]); assertEquals(code, 1); diff --git a/prettier/testdata/2.ts b/prettier/testdata/2.ts new file mode 100644 index 0000000000..e69de29bb2