{"record":{"id":"653906473f02cbae","repo":"denoland/deno","slug":"lint-watch-on-standard-input-is-not-supported","errorCode":null,"errorMessage":"Lint watch on standard input is not supported.","messagePattern":"Lint watch on standard input is not supported\\.","errorType":"exception","errorClass":"AnyError","httpStatus":null,"severity":"error","filePath":"cli/tools/lint/mod.rs","lineNumber":87,"sourceCode":"pub use linter::CliLinterOptions;\npub use plugins::PluginHostProxy;\npub use plugins::PluginLogger;\npub use plugins::create_runner_and_load_plugins;\npub use rules::ConfiguredRules;\npub use rules::LintRuleProvider;\npub use rules::collect_no_slow_type_diagnostics;\n\nconst JSON_SCHEMA_VERSION: u8 = 1;\n\nstatic STDIN_FILE_NAME: &str = \"$deno$stdin.mts\";\n\npub async fn lint(\n  flags: Arc<Flags>,\n  lint_flags: LintFlags,\n) -> Result<(), AnyError> {\n  if flags.watch.is_some() {\n    if lint_flags.is_stdin() {\n      return Err(anyhow!(\"Lint watch on standard input is not supported.\",));\n    }\n\n    return lint_with_watch(flags, lint_flags).await;\n  }\n\n  let factory = CliFactory::from_flags(flags);\n  let cli_options = factory.cli_options()?;\n  let lint_rule_provider = factory.lint_rule_provider().await?;\n  let is_stdin = lint_flags.is_stdin();\n  let compiler_options_resolver = factory.compiler_options_resolver()?;\n  let workspace_lint_options =\n    cli_options.resolve_workspace_lint_options(&lint_flags)?;\n  let success = if is_stdin {\n    lint_stdin(\n      cli_options,\n      lint_rule_provider,\n      workspace_lint_options,\n      lint_flags,","sourceCodeStart":69,"sourceCodeEnd":105,"githubUrl":"https://github.com/denoland/deno/blob/9ad36f7a2cce60488e6ec52283efb32efddaf93a/cli/tools/lint/mod.rs#L69-L105","documentation":"`deno lint --watch` re-lints files whenever they change, which requires watchable files on disk; standard input is a one-shot stream with nothing to watch. The lint entrypoint therefore rejects the combination up front instead of pretending to watch a stream that can never change.","triggerScenarios":"Invoking lint with both watch mode and stdin input: `deno lint --watch -`, or `cat file.ts | deno lint --watch` — i.e. lint_flags.is_stdin() is true while flags.watch is set, at cli/tools/lint/mod.rs:87.","commonSituations":"CI pipelines that always pipe into `deno lint -` but copied a `--watch` flag from a dev script; editor tasks and git hooks configured with both; one shared lint invocation used for interactive and piped modes.","solutions":["Drop `--watch` when linting stdin: `cat mod.ts | deno lint -`","Keep `--watch` but pass real paths: `deno lint --watch src/`","Make the watch flag conditional in shared scripts — only add it when the arguments are files/dirs, not `-`"],"exampleFix":"# before\ncat src/mod.ts | deno lint --watch -\n\n# after\ncat src/mod.ts | deno lint -   # one-shot stdin\ndeno lint --watch src/         # or watch real files","handlingStrategy":"validation","validationCode":"const args = Deno.args;\nif (args.includes('--watch') && (args.includes('-') || args.length === 0)) {\n  throw new Error('deno lint: --watch cannot be combined with stdin input');\n}","typeGuard":"const isStdinLint = (args: string[]): boolean =>\n  args.includes('-') || args.every(a => a.startsWith('-'));","tryCatchPattern":null,"preventionTips":["Keep interactive (watch) and piped (stdin) lint invocations separate","Centralize lint commands in task definitions so flags are not copy-pasted","Check flag combinations before scripting pipelines"],"tags":["lint","watch","stdin","cli-usage"],"backgroundTag":"incompatible-cli-flags","analyzedSha":"9ad36f7a2cce60488e6ec52283efb32efddaf93a","analyzedAt":"2026-08-20T13:07:44.778Z","contentChangedAt":"2026-08-20T13:07:44.778Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}