1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2025-01-07 22:58:24 -05:00

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.
This commit is contained in:
Geert-Jan Zwiers 2023-04-13 03:42:28 +02:00 committed by Levente Kurusa
parent 9161e1cacf
commit b3ff0eaee0
No known key found for this signature in database
GPG key ID: 9F72F3C05BA137C4

View file

@ -764,6 +764,7 @@ fn clap_root() -> Command {
fn bench_subcommand() -> Command { fn bench_subcommand() -> Command {
runtime_args(Command::new("bench"), true, false) runtime_args(Command::new("bench"), true, false)
.arg(check_arg(true))
.arg( .arg(
Arg::new("json") Arg::new("json")
.long("json") .long("json")
@ -814,6 +815,7 @@ glob {*_,*.,}bench.{js,mjs,ts,mts,jsx,tsx}:
fn bundle_subcommand() -> Command { fn bundle_subcommand() -> Command {
compile_args(Command::new("bundle")) compile_args(Command::new("bundle"))
.hide(true) .hide(true)
.arg(check_arg(true))
.arg( .arg(
Arg::new("source_file") Arg::new("source_file")
.required(true) .required(true)
@ -841,6 +843,7 @@ If no output file is given, the output is written to standard output:
fn cache_subcommand() -> Command { fn cache_subcommand() -> Command {
compile_args(Command::new("cache")) compile_args(Command::new("cache"))
.arg(check_arg(false))
.arg( .arg(
Arg::new("file") Arg::new("file")
.num_args(1..) .num_args(1..)
@ -898,6 +901,7 @@ Unless --reload is specified, this command will not re-download already cached d
fn compile_subcommand() -> Command { fn compile_subcommand() -> Command {
runtime_args(Command::new("compile"), true, false) runtime_args(Command::new("compile"), true, false)
.arg(script_arg().required(true)) .arg(script_arg().required(true))
.arg(check_arg(true))
.arg( .arg(
Arg::new("include") Arg::new("include")
.long("include") .long("include")
@ -1142,6 +1146,7 @@ To evaluate as TypeScript:
This command has implicit access to all permissions (--allow-all).", This command has implicit access to all permissions (--allow-all).",
) )
.arg(check_arg(false))
.arg( .arg(
// TODO(@satyarohith): remove this argument in 2.0. // TODO(@satyarohith): remove this argument in 2.0.
Arg::new("ts") Arg::new("ts")
@ -1340,6 +1345,7 @@ TypeScript compiler cache: Subdirectory containing TS compiler output.",
fn install_subcommand() -> Command { fn install_subcommand() -> Command {
runtime_args(Command::new("install"), true, true) runtime_args(Command::new("install"), true, true)
.arg(Arg::new("cmd").required(true).num_args(1..).value_hint(ValueHint::FilePath)) .arg(Arg::new("cmd").required(true).num_args(1..).value_hint(ValueHint::FilePath))
.arg(check_arg(true))
.arg( .arg(
Arg::new("name") Arg::new("name")
.long("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 { fn repl_subcommand() -> Command {
runtime_args(Command::new("repl"), true, true) runtime_args(Command::new("repl"), true, true)
.about("Read Eval Print Loop") .about("Read Eval Print Loop")
.arg(check_arg(false))
.arg( .arg(
Arg::new("eval-file") Arg::new("eval-file")
.long("eval-file") .long("eval-file")
@ -1560,6 +1567,7 @@ fn repl_subcommand() -> Command {
fn run_subcommand() -> Command { fn run_subcommand() -> Command {
runtime_args(Command::new("run"), true, true) runtime_args(Command::new("run"), true, true)
.arg(check_arg(false))
.arg( .arg(
watch_arg(true) watch_arg(true)
.conflicts_with("inspect") .conflicts_with("inspect")
@ -1622,6 +1630,7 @@ fn task_subcommand() -> Command {
fn test_subcommand() -> Command { fn test_subcommand() -> Command {
runtime_args(Command::new("test"), true, true) runtime_args(Command::new("test"), true, true)
.arg(check_arg(true))
.arg( .arg(
Arg::new("ignore") Arg::new("ignore")
.long("ignore") .long("ignore")
@ -1848,7 +1857,7 @@ Remote modules and multiple modules may also be specified:
} }
fn compile_args(app: Command) -> Command { 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 { 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 { fn check_arg(checks_local_by_default: bool) -> Arg {
Arg::new("check") let arg = Arg::new("check")
.conflicts_with("no-check") .conflicts_with("no-check")
.long("check") .long("check")
.num_args(0..=1) .num_args(0..=1)
.require_equals(true) .require_equals(true)
.value_name("CHECK_TYPE") .value_name("CHECK_TYPE")
.help("Type-check modules") .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.
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 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 { fn script_arg() -> Arg {