Skip to content

Commit e493317

Browse files
authored
docs(eslint-plugin): add FAQ about JSDoc link usage with no-unused-vars (typescript-eslint#11259)
* docs(no-unused-vars): add FAQ about link usage in JSDoc * lint: prettier fix * chore: small typo
1 parent 4bc7214 commit e493317

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

packages/eslint-plugin/docs/rules/no-unused-vars.mdx

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,3 +118,19 @@ export interface Box {
118118
</Tabs>
119119

120120
If you find yourself writing runtime values only for types, consider refactoring your code to declare types directly.
121+
122+
### Why are variables reported as unused despite being referenced by @link in JSDoc?
123+
124+
JSDoc references are not supported by typescript-eslint.
125+
You can use a rule such as [`jsdoc/no-undefined-types`](https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/no-undefined-types.md) to resolve variables as used in JSDoc comments.
126+
127+
```ts
128+
import type { Box } from './Box';
129+
// ~~~
130+
// 'Box' is defined but never used.
131+
132+
/**
133+
* @see {@link Box}
134+
*/
135+
export function getBox() {}
136+
```

0 commit comments

Comments
 (0)