1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-23 15:49:44 -05:00

feat: add --check for deno fmt (#3369)

This commit is contained in:
罗文 2019-11-19 02:19:59 +08:00 committed by Ry Dahl
parent 5671d38d8f
commit 542ec461c4

View file

@ -340,6 +340,12 @@ Automatically downloads Prettier dependencies on first run.
deno fmt myfile1.ts myfile2.ts", deno fmt myfile1.ts myfile2.ts",
) )
.arg(
Arg::with_name("check")
.long("check")
.help("Check if the source files are formatted.")
.takes_value(false),
)
.arg( .arg(
Arg::with_name("prettierrc") Arg::with_name("prettierrc")
.long("prettierrc") .long("prettierrc")
@ -992,6 +998,7 @@ pub fn flags_from_vec(
} }
let prettier_flags = [ let prettier_flags = [
["0", "check"],
["1", "prettierrc"], ["1", "prettierrc"],
["1", "ignore-path"], ["1", "ignore-path"],
["1", "print-width"], ["1", "print-width"],
@ -2088,6 +2095,7 @@ mod tests {
let (flags, subcommand, argv) = flags_from_vec(svec![ let (flags, subcommand, argv) = flags_from_vec(svec![
"deno", "deno",
"fmt", "fmt",
"--check",
"--prettierrc=auto", "--prettierrc=auto",
"--print-width=100", "--print-width=100",
"--tab-width=4", "--tab-width=4",
@ -2119,6 +2127,7 @@ mod tests {
PRETTIER_URL, PRETTIER_URL,
"script.ts", "script.ts",
"--write", "--write",
"--check",
"--config", "--config",
"auto", "auto",
"--ignore-path", "--ignore-path",