denoland/deno · error

Invalid lint report type in config file

Error message

Invalid lint report type in config file

What it means

deno lint reads the reporter format from the lint.report field of the config file. Only "pretty", "json", and "compact" are recognized; any other string makes CLI argument parsing bail with this message before linting starts. A --report CLI flag overrides the config value entirely.

Source

Thrown at cli/args/mod.rs:316

    lint_config: &WorkspaceLintConfig,
    lint_flags: &LintFlags,
  ) -> Result<Self, AnyError> {
    let mut maybe_reporter_kind = if lint_flags.json {
      Some(LintReporterKind::Json)
    } else if lint_flags.compact {
      Some(LintReporterKind::Compact)
    } else {
      None
    };

    if maybe_reporter_kind.is_none() {
      // Flag not set, so try to get lint reporter from the config file.
      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(_) => {
          bail!("Invalid lint report type in config file")
        }
        None => None,
      }
    }
    Ok(Self {
      reporter_kind: maybe_reporter_kind.unwrap_or_default(),
    })
  }
}

#[derive(Clone, Debug)]
pub struct LintOptions {
  pub rules: LintRulesConfig,
  pub files: FilePatterns,
  pub fix: bool,
  pub plugins: Vec<Url>,
}

View on GitHub (pinned to 9ad36f7a2c)

Solutions

  1. Set lint.report to "pretty", "json", or "compact" in the config file
  2. Or delete the report key to fall back to the default reporter
  3. Or override from the CLI: deno lint --report=json

Example fix

// before (deno.json)
{ "lint": { "report": "stylish" } }

// after
{ "lint": { "report": "pretty" } }
Defensive patterns

Strategy: validation

Validate before calling

// Check config before invoking deno lint
const config = JSON.parse(await Deno.readTextFile("deno.json"));
const report = config?.lint?.report;
if (report != null && !["pretty", "json", "compact"].includes(report)) {
  throw new Error(`invalid lint.report "${report}" - expected pretty|json|compact`);
}

Type guard

const isLintReporter = (v: unknown): v is "pretty" | "json" | "compact" =>
  v === "pretty" || v === "json" || v === "compact";

Prevention

When it happens

Trigger: A deno.json/deno.jsonc with "lint": { "report": "<not pretty|json|compact>" } and running deno lint without --report.

Common situations: Copy-pasted configs from other linters (eslint's "stylish", "junit"); typos like "compct"; expecting a reporter format this Deno version does not offer.

Understand the failure class

Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.

Related errors


AI-assisted analysis of denoland/deno@9ad36f7a2c (2026-08-20). Data as JSON: /api/errors/476e8e857e3b0d81. Report an issue: GitHub.