denoland/deno · error

Lint watch on standard input is not supported.

Error message

Lint watch on standard input is not supported.

What it means

`deno lint` reads source from standard input when no files are given (or '-' is used). Watching requires watchable filesystem paths, so combining --watch with stdin input is rejected up front before anything is linted.

Source

Thrown at cli/tools/lint/mod.rs:87

pub use linter::CliLinterOptions;
pub use plugins::PluginHostProxy;
pub use plugins::PluginLogger;
pub use plugins::create_runner_and_load_plugins;
pub use rules::ConfiguredRules;
pub use rules::LintRuleProvider;
pub use rules::collect_no_slow_type_diagnostics;

const JSON_SCHEMA_VERSION: u8 = 1;

static STDIN_FILE_NAME: &str = "$deno$stdin.mts";

pub async fn lint(
  flags: Arc<Flags>,
  lint_flags: LintFlags,
) -> Result<(), AnyError> {
  if flags.watch.is_some() {
    if lint_flags.is_stdin() {
      return Err(anyhow!("Lint watch on standard input is not supported.",));
    }

    return lint_with_watch(flags, lint_flags).await;
  }

  let factory = CliFactory::from_flags(flags);
  let cli_options = factory.cli_options()?;
  let lint_rule_provider = factory.lint_rule_provider().await?;
  let is_stdin = lint_flags.is_stdin();
  let compiler_options_resolver = factory.compiler_options_resolver()?;
  let workspace_lint_options =
    cli_options.resolve_workspace_lint_options(&lint_flags)?;
  let success = if is_stdin {
    lint_stdin(
      cli_options,
      lint_rule_provider,
      workspace_lint_options,
      lint_flags,

View on GitHub (pinned to 89f33cbef2)

Solutions

  1. Drop --watch when linting stdin: cat src/mod.ts | deno lint -
  2. Or write the buffer to a temp .ts file and lint that path if you need watching
  3. Reserve --watch for interactive terminal sessions on real paths

Example fix

# before
cat src/mod.ts | deno lint --watch -
# after
cat src/mod.ts | deno lint -
Defensive patterns

Strategy: validation

Validate before calling

# strip --watch from the args when stdin is not a tty (input is piped)
if [ ! -t 0 ]; then
  set -- $(printf '%s\n' "$@" | grep -v -- '--watch')
fi
deno lint "$@" -

Prevention

When it happens

Trigger: Invoking `deno lint --watch` with no path arguments while data is piped in (or with explicit stdin input), e.g. `cat file.ts | deno lint --watch -`.

Common situations: Editor/format-on-save hooks and lint-staged-style pipelines that pipe buffers but reuse a --watch flag from a dev script; CI configs copying a watch-based lint command verbatim.

Related errors


AI-assisted analysis of denoland/deno@89f33cbef2 (2026-08-16). Data as JSON: /api/errors/653906473f02cbae. Report an issue: GitHub.