summaryrefslogtreecommitdiff
path: root/cli/tools/lint.rs
diff options
context:
space:
mode:
Diffstat (limited to 'cli/tools/lint.rs')
-rw-r--r--cli/tools/lint.rs28
1 files changed, 22 insertions, 6 deletions
diff --git a/cli/tools/lint.rs b/cli/tools/lint.rs
index 9afc9cd46..bfbff8005 100644
--- a/cli/tools/lint.rs
+++ b/cli/tools/lint.rs
@@ -77,6 +77,13 @@ pub async fn lint(flags: Flags, lint_flags: LintFlags) -> Result<(), AnyError> {
// and `--ignore` CLI flag, only the flag value is taken into account.
let mut include_files = args.clone();
let mut exclude_files = ignore.clone();
+ let mut maybe_reporter_kind = if json {
+ Some(LintReporterKind::Json)
+ } else if compact {
+ Some(LintReporterKind::Compact)
+ } else {
+ None
+ };
let ps = ProcState::build(flags).await?;
let maybe_lint_config = ps.options.to_lint_config()?;
@@ -99,18 +106,27 @@ pub async fn lint(flags: Flags, lint_flags: LintFlags) -> Result<(), AnyError> {
.filter_map(|s| specifier_to_file_path(s).ok())
.collect::<Vec<_>>();
}
+
+ if maybe_reporter_kind.is_none() {
+ maybe_reporter_kind = match lint_config.report.as_deref() {
+ Some("json") => Some(LintReporterKind::Json),
+ Some("compact") => Some(LintReporterKind::Compact),
+ Some("pretty") => Some(LintReporterKind::Pretty),
+ Some(_) => {
+ return Err(anyhow!("Invalid lint report type in config file"))
+ }
+ None => Some(LintReporterKind::Pretty),
+ }
+ }
}
if include_files.is_empty() {
include_files = [std::env::current_dir()?].to_vec();
}
- let reporter_kind = if json {
- LintReporterKind::Json
- } else if compact {
- LintReporterKind::Compact
- } else {
- LintReporterKind::Pretty
+ let reporter_kind = match maybe_reporter_kind {
+ Some(report) => report,
+ None => LintReporterKind::Pretty,
};
let has_error = Arc::new(AtomicBool::new(false));