From b3ff0eaee0d6c4f6277c6c671cea210400b033cb Mon Sep 17 00:00:00 2001 From: Geert-Jan Zwiers Date: Thu, 13 Apr 2023 03:42:28 +0200 Subject: [PATCH] chore(docs): clarify what subcommands do not type-check by default (#18520) The CLI docs suggested that all deno subcommands no longer type-check by default. This is only the case for some subcommands, and this PR clarifies the CLI docs in this regard. --- cli/args/flags.rs | 39 +++++++++++++++++++++++++++++---------- 1 file changed, 29 insertions(+), 10 deletions(-) diff --git a/cli/args/flags.rs b/cli/args/flags.rs index ed7a59051b..aae08a09b9 100644 --- a/cli/args/flags.rs +++ b/cli/args/flags.rs @@ -764,6 +764,7 @@ fn clap_root() -> Command { fn bench_subcommand() -> Command { runtime_args(Command::new("bench"), true, false) + .arg(check_arg(true)) .arg( Arg::new("json") .long("json") @@ -814,6 +815,7 @@ glob {*_,*.,}bench.{js,mjs,ts,mts,jsx,tsx}: fn bundle_subcommand() -> Command { compile_args(Command::new("bundle")) .hide(true) + .arg(check_arg(true)) .arg( Arg::new("source_file") .required(true) @@ -841,6 +843,7 @@ If no output file is given, the output is written to standard output: fn cache_subcommand() -> Command { compile_args(Command::new("cache")) + .arg(check_arg(false)) .arg( Arg::new("file") .num_args(1..) @@ -898,6 +901,7 @@ Unless --reload is specified, this command will not re-download already cached d fn compile_subcommand() -> Command { runtime_args(Command::new("compile"), true, false) .arg(script_arg().required(true)) + .arg(check_arg(true)) .arg( Arg::new("include") .long("include") @@ -1142,6 +1146,7 @@ To evaluate as TypeScript: This command has implicit access to all permissions (--allow-all).", ) + .arg(check_arg(false)) .arg( // TODO(@satyarohith): remove this argument in 2.0. Arg::new("ts") @@ -1340,6 +1345,7 @@ TypeScript compiler cache: Subdirectory containing TS compiler output.", fn install_subcommand() -> Command { runtime_args(Command::new("install"), true, true) .arg(Arg::new("cmd").required(true).num_args(1..).value_hint(ValueHint::FilePath)) + .arg(check_arg(true)) .arg( Arg::new("name") .long("name") @@ -1541,6 +1547,7 @@ Ignore linting a file by adding an ignore comment at the top of the file: fn repl_subcommand() -> Command { runtime_args(Command::new("repl"), true, true) .about("Read Eval Print Loop") + .arg(check_arg(false)) .arg( Arg::new("eval-file") .long("eval-file") @@ -1560,6 +1567,7 @@ fn repl_subcommand() -> Command { fn run_subcommand() -> Command { runtime_args(Command::new("run"), true, true) + .arg(check_arg(false)) .arg( watch_arg(true) .conflicts_with("inspect") @@ -1622,6 +1630,7 @@ fn task_subcommand() -> Command { fn test_subcommand() -> Command { runtime_args(Command::new("test"), true, true) + .arg(check_arg(true)) .arg( Arg::new("ignore") .long("ignore") @@ -1848,7 +1857,7 @@ Remote modules and multiple modules may also be specified: } fn compile_args(app: Command) -> Command { - compile_args_without_check_args(app.arg(no_check_arg()).arg(check_arg())) + compile_args_without_check_args(app.arg(no_check_arg())) } fn compile_args_without_check_args(app: Command) -> Command { @@ -2199,23 +2208,33 @@ diagnostic errors from remote modules will be ignored.", ) } -fn check_arg() -> Arg { - Arg::new("check") +fn check_arg(checks_local_by_default: bool) -> Arg { + let arg = Arg::new("check") .conflicts_with("no-check") .long("check") .num_args(0..=1) .require_equals(true) .value_name("CHECK_TYPE") - .help("Type-check modules") - .long_help( - "Type-check modules. - -Deno does not type-check modules automatically from v1.23 onwards. Pass this -flag to enable type-checking or use the 'deno check' subcommand. + .help("Type-check modules"); + if checks_local_by_default { + arg.long_help( + "Set type-checking behavior. This subcommand type-checks local modules by +default, so adding --check is redundant. If the value of '--check=all' is supplied, diagnostic errors from remote modules -will be included.", +will be included. + +Alternatively, the 'deno check' subcommand can be used.", ) + } else { + arg.long_help( + "Enable type-checking. This subcommand does not type-check by default. +If the value of '--check=all' is supplied, diagnostic errors from remote modules +will be included. + +Alternatively, the 'deno check' subcommand can be used.", + ) + } } fn script_arg() -> Arg {