# imports-as-dependencies

Rule `jsdoc/imports-as-dependencies`. Reports if JSDoc `import()` statements point to a package which is not listed in `dependencies` or `devDependencies`

- Source: jsdoc
- Technologies: JSDoc
- Kind: style
- Needs type information: no
- Autofix: no
- Reach: 413K weekly downloads of presets that enable it
- Trend: −5.0% last quarter
- Rank: #1629 by reach, #1640 by growth

## Linters

| Linter | Rule name | Recommended | Autofix | Details | Docs |
| --- | --- | --- | --- | --- | --- |
| ESLint | `jsdoc/imports-as-dependencies` | no | no | package `eslint-plugin-jsdoc` | [docs](https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/imports-as-dependencies.md#repos-sticky-header) |

## Code examples

### Incorrect: the rule reports this

```ts
/**
 * @type {null|import('sth').SomeApi}
 */
```

### Correct: the rule accepts this

```ts
/**
 * @type {null|import('eslint').ESLint}
 */
```

Examples from the ESLint documentation.

## Enable it

### ESLint: `eslint.config.js`

```js
import jsdoc from "eslint-plugin-jsdoc";

export default [
  {
    plugins: { jsdoc },
    rules: {
      "jsdoc/imports-as-dependencies": "error",
    },
  },
];
```

## Presets that enable it

| Preset | Linter | Package | Rules | Weekly downloads | Trend |
| --- | --- | --- | --- | --- | --- |
| [XO](https://lintradar.dev/presets/xo.md) | ESLint | `eslint-config-xo` | 618 | 413K | −5.0% |

## Related rules

- [jsdoc/check-template-names](https://lintradar.dev/rules/jsdoc/check-template-names.md): Checks that any `@template` names are actually used in the connected `@typedef` or type alias.
- [jsdoc/informative-docs](https://lintradar.dev/rules/jsdoc/informative-docs.md): This rule reports doc comments that only restate their attached name.
- [jsdoc/check-syntax](https://lintradar.dev/rules/jsdoc/check-syntax.md): Reports against syntax not valid for the mode (e.g., Google Closure Compiler in non-Closure mode).
- [jsdoc/no-bad-blocks](https://lintradar.dev/rules/jsdoc/no-bad-blocks.md): This rule checks for multi-line-style comments which fail to meet the criteria of a JSDoc block.
- [jsdoc/check-line-alignment](https://lintradar.dev/rules/jsdoc/check-line-alignment.md): Reports invalid alignment of JSDoc block lines.
- [jsdoc/no-blank-block-descriptions](https://lintradar.dev/rules/jsdoc/no-blank-block-descriptions.md): If tags are present, this rule will prevent empty lines in the block description. If no tags are present, this rule will prevent extra empty lines in the block description.

---

Web page: https://lintradar.dev/rules/jsdoc/imports-as-dependencies. Data from npm and the linters' documentation, collected Dec 4, 2026. Site guide for agents: https://lintradar.dev/llms.txt
