1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2025-01-13 17:39:18 -05:00

Fix eslint warnings and small clean ups (#339)

This commit is contained in:
Vincent LE GOFF 2019-04-14 16:53:19 +02:00 committed by Ryan Dahl
parent 4d25cc1e35
commit 95ab4e2a3c
4 changed files with 6 additions and 5 deletions

View file

@ -31,7 +31,7 @@ ensureDir("./bar"); // returns a promise
ensureDirSync("./ensureDirSync"); // void ensureDirSync("./ensureDirSync"); // void
``` ```
### ensure_file ### ensureFile
Ensures that the file exists. Ensures that the file exists.
If the file that is requested to be created is in directories If the file that is requested to be created is in directories

View file

@ -107,7 +107,8 @@ test(async function testPrettierOptions() {
const file2 = join(testdata, "opts", "2.ts"); const file2 = join(testdata, "opts", "2.ts");
const file3 = join(testdata, "opts", "3.md"); const file3 = join(testdata, "opts", "3.md");
const getSourceCode = async f => decoder.decode(await Deno.readFile(f)); const getSourceCode = async (f: string): Promise<string> =>
decoder.decode(await Deno.readFile(f));
await run([...cmd, "--no-semi", file0]); await run([...cmd, "--no-semi", file0]);
assertEquals( assertEquals(

View file

@ -1,7 +1,7 @@
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. // Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
import { runTests } from "./mod.ts"; import { runTests } from "./mod.ts";
async function main() { async function main(): Promise<void> {
// Testing entire test suite serially // Testing entire test suite serially
await runTests(); await runTests();
} }

View file

@ -1,5 +1,6 @@
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. // Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
import { existsSync } from "../fs/exists.ts"; import { existsSync } from "../fs/exists.ts";
import { readFileStrSync } from "../fs/read_file_str.ts";
import { deepAssign } from "../util/deep_assign.ts"; import { deepAssign } from "../util/deep_assign.ts";
import { pad } from "../strings/pad.ts"; import { pad } from "../strings/pad.ts";
@ -542,7 +543,6 @@ export function parseFile(filePath: string): object {
if (!existsSync(filePath)) { if (!existsSync(filePath)) {
throw new Error("File not found"); throw new Error("File not found");
} }
const decoder = new TextDecoder(); const strFile = readFileStrSync(filePath);
const strFile = decoder.decode(Deno.readFileSync(filePath));
return parse(strFile); return parse(strFile);
} }