1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-27 16:10:57 -05:00

Fix prettier check in empty files (denoland/deno_std#302)

Original: e5a493e9e8
This commit is contained in:
Bartek Iwańczuk 2019-03-24 16:26:47 +01:00 committed by Ryan Dahl
parent aae6ea51a4
commit 4347148d50
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