Description
Expected behavior
Single-line @import
jsdoc comments should be considered valid, and the import(s) visible to later @type
etc jsdoc comments.
Actual behavior
A single-line @import
comment triggers a Bad @import tag
warning from jsdoc/check-values
.
A later @type
commment using that import triggers a The type '<type>' is undefined
warning from jsdoc/no-undefined-types
.
Neither of these warnings appear when using version 50.6.9 of the plugin, or if the @import
tag is used in a multi-line comment.
ESLint Config
import jsdoc from 'eslint-plugin-jsdoc'
export default [
jsdoc.configs['flat/recommended'],
]
ESLint sample
This code generates warnings:
/** @import { ReactNode } from 'react' */
/** @type {ReactNode} */
export const TEST = null
This code does not generate warnings:
/**
* @import { ReactNode } from 'react'
*/
/** @type {ReactNode} */
export const TEST = null
Environment
- Node version: v23.10.0
- ESLint version: v9.25.1
eslint-plugin-jsdoc
version: 50.6.10