deno.json: Project Configuration for CI
deno.json (or deno.jsonc) is the project config file holding tasks, imports, formatter, linter, and TypeScript options.
Centralizing settings in deno.json is what keeps a Deno CI pipeline reproducible: the same tasks, dependencies, and rules apply locally and on the runner.
What it does
deno.json is auto-discovered from the working directory upward. It defines "tasks" (run with deno task), "imports" (the import map for bare specifiers), "fmt" and "lint" settings, "compilerOptions" for type-checking, and "vendor" for offline builds. deno.jsonc allows comments.
Common usage
{
"tasks": { "ci": "deno fmt --check && deno lint && deno test" },
"imports": { "@std/assert": "jsr:@std/assert@^1" },
"fmt": { "exclude": ["dist/"] },
"lint": { "rules": { "exclude": ["no-explicit-any"] } },
"compilerOptions": { "strict": true }
}Options
| Field | What it does |
|---|---|
| tasks | Named commands run via deno task |
| imports | Import map for bare specifiers (jsr:/npm:/URLs) |
| fmt / lint | Formatter and linter options and exclusions |
| compilerOptions | TypeScript options such as strict |
| vendor | Set true to vendor dependencies (Deno 2) |
| lock | Lockfile path or false to disable |
In CI
Commit deno.json and deno.lock together and run deno install --frozen so CI fails on drift. Keep fmt, lint, and task definitions here so a single deno task ci reproduces the whole pipeline. Use --config only when the file is not in the default location.
Common errors in CI
"error: Unable to parse config file" means invalid JSON, often a trailing comma in a plain .json (rename to .jsonc for comments). "Invalid compiler option" flags an unknown compilerOptions key. "No config file found" means deno.json is missing in the working directory. A bad "imports" entry shows up later as a module-resolution failure.