Skip to content

Commit facfef4

Browse files
panagosg7facebook-github-bot
authored andcommitted
[flow] add '--no-autoimports' flag
Summary: Changelog: [internal] Reviewed By: gkz Differential Revision: D69668539 ------------------------------------------------------------------------ (from 21ee15b05c8e3ce35e5c12526d44185de47cc499) fbshipit-source-id: 136a0cf6a176e3141de7db9994509f2759a2439f
1 parent 95569af commit facfef4

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

src/commands/commandUtils.ml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -918,6 +918,7 @@ module Options_flags = struct
918918
estimate_recheck_time: bool option;
919919
long_lived_workers: bool option;
920920
distributed: bool;
921+
no_autoimports: bool;
921922
}
922923
end
923924

@@ -981,7 +982,8 @@ let options_flags =
981982
include_suppressions
982983
estimate_recheck_time
983984
long_lived_workers
984-
distributed =
985+
distributed
986+
no_autoimports =
985987
(match merge_timeout with
986988
| Some timeout when timeout < 0 ->
987989
Exit.(exit ~msg:"--merge-timeout must be non-negative" Commandline_usage_error)
@@ -1009,6 +1011,7 @@ let options_flags =
10091011
estimate_recheck_time;
10101012
long_lived_workers;
10111013
distributed;
1014+
no_autoimports;
10121015
}
10131016
in
10141017
fun prev ->
@@ -1057,6 +1060,7 @@ let options_flags =
10571060
|> flag "--estimate-recheck-time" (optional bool) ~doc:"" ~env:"FLOW_ESTIMATE_RECHECK_TIME"
10581061
|> flag "--long-lived-workers" (optional bool) ~doc:"" ~env:"FLOW_LONG_LIVED_WORKERS"
10591062
|> flag "--distributed" truthy ~doc:""
1063+
|> flag "--no-autoimports" truthy ~doc:"Disable auto-imports"
10601064
)
10611065

10621066
let saved_state_flags =
@@ -1484,7 +1488,9 @@ let make_options
14841488
opt_automatic_require_default =
14851489
Base.Option.value (FlowConfig.automatic_require_default flowconfig) ~default:false;
14861490
opt_format;
1487-
opt_autoimports = Base.Option.value (FlowConfig.autoimports flowconfig) ~default:true;
1491+
opt_autoimports =
1492+
(not options_flags.no_autoimports)
1493+
&& Base.Option.value (FlowConfig.autoimports flowconfig) ~default:true;
14881494
opt_autoimports_min_characters =
14891495
Base.Option.value (FlowConfig.autoimports_min_characters flowconfig) ~default:0;
14901496
opt_autoimports_ranked_by_usage = FlowConfig.autoimports_ranked_by_usage flowconfig;

src/common/test_utils/test_utils.ml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ let make_options_flags
3535
?estimate_recheck_time
3636
?long_lived_workers
3737
?(distributed = false)
38+
?(no_autoimports = false)
3839
() =
3940
{
4041
CommandUtils.Options_flags.all;
@@ -57,6 +58,7 @@ let make_options_flags
5758
estimate_recheck_time;
5859
long_lived_workers;
5960
distributed;
61+
no_autoimports;
6062
}
6163

6264
let make_saved_state_flags

0 commit comments

Comments
 (0)