diff options
author | Bartek IwaĆczuk <biwanczuk@gmail.com> | 2022-05-17 23:53:42 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-17 23:53:42 +0200 |
commit | 9a85a95c435968e5bdf6e71192be3ed239fd2205 (patch) | |
tree | 7c51e96bd0f6f7a2565f688bef85de82b5fdf790 /cli/main.rs | |
parent | 330c820ae8d7826dfe3d88c01ba07728121fa021 (diff) |
feat: subcommands type-check only local files by default (#14623)
This commit changes default mode of type-checking to "local"
and adds "--check" flag to following subcommands:
- deno bench
- deno bundle
- deno cache
- deno compile
- deno eval
- deno install
- deno test
Diffstat (limited to 'cli/main.rs')
-rw-r--r-- | cli/main.rs | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/cli/main.rs b/cli/main.rs index 9bbe8cfcb..2058c487a 100644 --- a/cli/main.rs +++ b/cli/main.rs @@ -1531,18 +1531,23 @@ pub fn main() { logger::init(flags.log_level); - // TODO(bartlomieju): remove once type checking is skipped by default (probably - // in 1.23). - // If this env var is set we're gonna override default behavior of type checking - // and use behavior defined by the `--check` flag. + // TODO(bartlomieju): v1.22 is a "pivot version" in terms of default + // type checking mode. We're opting into type checking only local + // files by default and in v1.23 we're not gonna type check at all by default. + // So right now, we're still allowing to use `--no-check` flag and if it is + // present, we opt into the "old" behavior. Additionally, if + // "DENO_FUTURE_CHECK" env var is present we're switching to the new behavior + // of skipping type checking completely if no `--check` flag is present. let future_check_env_var = env::var("DENO_FUTURE_CHECK").ok(); if let Some(env_var) = future_check_env_var { - if env_var == "1" { - flags.type_check_mode = match &flags.future_type_check_mode { - FutureTypeCheckMode::None => TypeCheckMode::None, - FutureTypeCheckMode::All => TypeCheckMode::All, - FutureTypeCheckMode::Local => TypeCheckMode::Local, - } + if env_var == "1" && !flags.has_check_flag { + flags.type_check_mode = TypeCheckMode::None; + } + } else if !flags.has_no_check_flag { + flags.type_check_mode = match &flags.future_type_check_mode { + FutureTypeCheckMode::None => TypeCheckMode::None, + FutureTypeCheckMode::All => TypeCheckMode::All, + FutureTypeCheckMode::Local => TypeCheckMode::Local, } } |