Configuration File
Format
JSDoc accepts a JSON file (jsdoc.json or .jsdocrc) passed via --configure / -c:
Run with your config file
npx jsdoc -c jsdoc.jsonThe file contains a JSON object with top-level keys for each configuration domain.
Top-level keys
source
Controls which files JSDoc processes.
{
"source": {
"include": ["src", "lib"],
"exclude": ["src/vendor"],
"includePattern": ".+\\.js$",
"excludePattern": "(^|\\/|\\\\)_"
}
}
| Key | Type | Description |
|---|---|---|
include | string[] | Paths to files or directories to include. |
exclude | string[] | Paths to exclude from processing. |
includePattern | string | Regex — only files matching this pattern are processed. |
excludePattern | string | Regex — files matching this pattern are excluded. |
opts
Mirrors the command-line flags.
{
"opts": {
"destination": "docs",
"recurse": true,
"readme": "README.md",
"package": "./package.json",
"template": "jsdoc-template",
"tutorials": "tutorials",
"encoding": "utf8",
"access": "public",
"private": false,
"pedantic": false,
"verbose": false
}
}
plugins
An array of plugin paths or module names to load:
{
"plugins": [
"plugins/markdown"
]
}
tags
Tag parser settings.
{
"tags": {
"allowUnknownTags": true,
"dictionaries": ["jsdoc", "closure"]
}
}
| Key | Type | Default | Description |
|---|---|---|---|
allowUnknownTags | boolean | true | Allow tags not in the configured dictionaries. |
dictionaries | string[] | ["jsdoc","closure"] | Tag dictionaries to use. |
templates
Settings passed to the documentation template.
{
"templates": {
"cleverLinks": false,
"monospaceLinks": false
}
}
Complete example
{
"source": {
"include": ["src"],
"includePattern": ".+\\.js$",
"excludePattern": "(^|\\/|\\\\)_"
},
"opts": {
"destination": "docs",
"recurse": true,
"readme": "README.md"
},
"plugins": ["plugins/markdown"],
"tags": {
"allowUnknownTags": true,
"dictionaries": ["jsdoc"]
},
"templates": {
"cleverLinks": true
}
}
See also
Official reference: jsdoc.app/about-configuring-jsdoc