denoland/deno · error
No target files found.
Error message
No target files found.
What it means
After collecting files for every workspace member, `deno lint` refuses to proceed when the matched set is empty and --permit-no-files was not passed. This is a deliberate guard against silently-successful runs where include/exclude patterns accidentally match nothing (especially in CI).
Source
Thrown at cli/tools/lint/mod.rs:248
cli_options: &CliOptions,
lint_flags: &LintFlags,
) -> Result<Vec<PathsWithOptions>, AnyError> {
let members_lint_options =
cli_options.resolve_lint_options_for_members(lint_flags)?;
let mut paths_with_options_batches =
Vec::with_capacity(members_lint_options.len());
for (dir, lint_options) in members_lint_options {
let files = collect_lint_files(cli_options, lint_options.files.clone());
if !files.is_empty() {
paths_with_options_batches.push(PathsWithOptions {
dir,
paths: files,
options: lint_options,
});
}
}
if paths_with_options_batches.is_empty() && !lint_flags.permit_no_files {
return Err(anyhow!("No target files found."));
}
Ok(paths_with_options_batches)
}
type WorkspaceModuleGraphFuture =
SharedLocal<LocalBoxFuture<'static, Result<Rc<ModuleGraph>, Rc<AnyError>>>>;
struct WorkspaceLinter {
caches: Arc<Caches>,
lint_rule_provider: LintRuleProvider,
module_graph_creator: Arc<ModuleGraphCreator>,
compiler_options_resolver: Arc<CompilerOptionsResolver>,
workspace_dir: Arc<WorkspaceDirectory>,
reporter_lock: Arc<Mutex<Box<dyn LintReporter + Send>>>,
workspace_module_graph: Option<WorkspaceModuleGraphFuture>,
has_error: Arc<AtomicFlag>,
file_count: usize,
}View on GitHub (pinned to 89f33cbef2)
Solutions
- Verify you are in the intended directory and that source files exist
- Review the "lint": { "include": ..., "exclude": ... } block in deno.json and loosen patterns that exclude everything
- For directories that may legitimately contain nothing to lint, pass --permit-no-files
- Treat --permit-no-files as an explicit per-project decision, not a blanket default
Example fix
// deno.json before
"lint": { "include": ["src/**/*.ts"], "exclude": ["src"] }
// after
"lint": { "include": ["src/**/*.ts"] } Defensive patterns
Strategy: validation
Validate before calling
# fail with your own message before deno does
shopt -s globstar nullglob
files=(**/*.mts **/*.cts **/*.ts **/*.tsx **/*.js **/*.jsx)
if [ ${#files[@]} -eq 0 ]; then
echo "no lintable files under $PWD — check lint include/exclude" >&2
exit 2
fi
deno lint Prevention
- Keep lint include patterns anchored at the package root and minimal
- Decide per project whether zero files is acceptable and encode it explicitly with --permit-no-files
When it happens
Trigger: `deno lint` in a tree with no matching JS/TS files; deno.json lint include/exclude patterns that filter out everything; running from a cwd whose glob base contains no sources.
Common situations: Fresh or generated repos with no sources yet; overly broad "exclude" entries; monorepo cwd confusion; CI templates linting directories that may legitimately be empty.
Related errors
- ${prefix}Linter plugin name must only contain lowercase lett
- Linter plugin ${plugin.name} has already been registered
- Unexpected 'name' field in options, bench name is already pr
- Unexpected second argument to Deno.bench()
- Unexpected third argument to Deno.bench()
AI-assisted analysis of denoland/deno@89f33cbef2 (2026-08-16).
Data as JSON: /api/errors/f6f41ae5c1162fec.
Report an issue: GitHub.