Skip to content

script-utils/linters/eslint-rules/no-unresolved-jsdoc-link

ESLint rule: no-unresolved-jsdoc-link

Reports a JSDoc link, linkcode or linkplain inline tag whose target no longer resolves to a symbol.

A rename leaves OldName behind and nothing else reports it: jsdoc/no-undefined-types does not resolve link targets, TSDoc checks only the tag syntax, and tsc parses JSDoc links without ever diagnosing them. So a dead link survives until somebody happens to click it.

A target resolves when any of these finds it, tried in order:

  1. The type checker, at the comment’s own location, exactly as editor go-to-definition does — so everything in scope there resolves: type parameters, parameters, imports, and the DOM / ES globals. 2. A declaration anywhere in the same file — a function nested in another, a private method — which is out of scope at a *Params interface naming it, yet is exactly what a rename of it would break. 3. The exports of any module in the program, by name. A comment routinely names a type its file never imports (an integration test naming the class it drives through evalInObsidian, a remark naming an Obsidian API), and the API docs generator resolves such a name library-wide too. This keeps the rule about DEAD links rather than about imports: a renamed or removed declaration is exported by no module, so it is still reported. 4. A module named by its specifier or its path, in both TSDoc forms: obsidian#Events#on (the package as the first segment) and error!errorToString / obsidian/components/plugin-gate-component!PluginConflictSeverity.Warn (a module path, ending with !) — plus TypeScript’s own import('./module.ts').Member. A path matches any source file in the program whose path ends with it.

After the first segment, each further . / # segment is looked up as a member: a namespace or module export, a static or instance member, or a property of the previous member’s type — so App.vault.adapter resolves.

A link that is not a code reference is skipped: a URL (https://example.com) and a JSDoc namepath (module:foo) both parse as a name followed by text starting with :, and a link with no name has nothing to resolve.

Variable Description
MESSAGE_ID Message ID reported when a JSDoc link target does not resolve to a symbol.
noUnresolvedJsdocLink The ESLint rule that reports JSDoc links whose target does not resolve.