mirror of
https://github.com/denoland/deno.git
synced 2024-12-26 09:10:40 -05:00
Fix prettier check in empty files (#302)
This commit is contained in:
parent
e80f144890
commit
e5a493e9e8
3 changed files with 7 additions and 3 deletions
|
@ -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, {
|
||||
|
|
|
@ -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
0
prettier/testdata/2.ts
vendored
Normal file
Loading…
Reference in a new issue