diff options
| author | Kitson Kelly <me@kitsonkelly.com> | 2019-03-05 11:53:35 +1100 |
|---|---|---|
| committer | Ryan Dahl <ry@tinyclouds.org> | 2019-03-04 19:53:35 -0500 |
| commit | 17663c12326dd1053f89a3bd741807f139973dae (patch) | |
| tree | 4588e84042b0155e11d7f5442ae38a6007922585 /prettier | |
| parent | 9f33cd28963a72d8fea0b1e99bb61ca9bec21a94 (diff) | |
Add eslint for linting (denoland/deno_std#235)
Original: https://github.com/denoland/deno_std/commit/c0390ade3de4d825423c9f0f5e1aa56ffd509942
Diffstat (limited to 'prettier')
| -rwxr-xr-x | prettier/main.ts | 6 | ||||
| -rw-r--r-- | prettier/main_test.ts | 6 | ||||
| -rw-r--r-- | prettier/prettier.ts | 1 | ||||
| -rw-r--r-- | prettier/util.ts | 2 |
4 files changed, 9 insertions, 6 deletions
diff --git a/prettier/main.ts b/prettier/main.ts index 70c225086..286cba58c 100755 --- a/prettier/main.ts +++ b/prettier/main.ts @@ -2,7 +2,7 @@ // Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. // This script formats the given source files. If the files are omitted, it // formats the all files in the repository. -const { args, platform, readAll, lstat, exit, run, readFile, writeFile } = Deno; +const { args, readAll, lstat, exit, readFile, writeFile } = Deno; import { xrun } from "./util.ts"; import { parse } from "../flags/mod.ts"; import { prettier, prettierPlugins } from "./prettier.ts"; @@ -67,7 +67,7 @@ async function getSourceFiles(args: string[]): Promise<string[]> { } // Filters out the files which contains any pattern in the given ignoreList. -function filterIgnoreList(files: string[], ignoreList: string[]) { +function filterIgnoreList(files: string[], ignoreList: string[]): string[] { return files.filter(path => ignoreList.every(pattern => !path.includes(pattern)) ); @@ -203,7 +203,7 @@ async function formatSourceFiles( exit(0); } -async function main(opts) { +async function main(opts): Promise<void> { const { help, ignore, check, _: args } = opts; if (help) { diff --git a/prettier/main_test.ts b/prettier/main_test.ts index 165081e00..b6c0489ee 100644 --- a/prettier/main_test.ts +++ b/prettier/main_test.ts @@ -5,7 +5,9 @@ const { readAll } = Deno; const decoder = new TextDecoder(); -async function run(args: string[]) { +async function run( + args: string[] +): Promise<{ stdout: string; code: number | undefined }> { const p = xrun({ args, stdout: "piped" }); const stdout = decoder.decode(await readAll(p.stdout)); @@ -33,7 +35,7 @@ function normalizeOutput(output: string): string { .join("\n"); } -async function clearTestdataChanges() { +async function clearTestdataChanges(): Promise<void> { await xrun({ args: ["git", "checkout", testdata] }).status(); } diff --git a/prettier/prettier.ts b/prettier/prettier.ts index 67099c5ca..98f36a78d 100644 --- a/prettier/prettier.ts +++ b/prettier/prettier.ts @@ -5,6 +5,7 @@ import "./vendor/parser_babylon.js"; import "./vendor/parser_markdown.js"; // TODO: provide decent type declarions for these +// eslint-disable-next-line @typescript-eslint/no-explicit-any const { prettier, prettierPlugins } = window as any; export { prettier, prettierPlugins }; diff --git a/prettier/util.ts b/prettier/util.ts index 0be583f75..425cbfe96 100644 --- a/prettier/util.ts +++ b/prettier/util.ts @@ -2,7 +2,7 @@ const { platform, run } = Deno; // Runs a command in cross-platform way -export function xrun(opts) { +export function xrun(opts): Deno.Process { return run({ ...opts, args: platform.os === "win" ? ["cmd.exe", "/c", ...opts.args] : opts.args |
