1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-27 01:29:14 -05:00

Fix prettier check in empty files (#302)

This commit is contained in:
Bartek Iwańczuk 2019-03-24 16:26:47 +01:00 committed by Ryan Dahl
parent e80f144890
commit e5a493e9e8
3 changed files with 7 additions and 3 deletions

View file

@ -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, {

View file

@ -48,7 +48,11 @@ async function clearTestdataChanges(): Promise<void> {
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);

0
prettier/testdata/2.ts vendored Normal file
View file