Skip to content

Single-line @import comment no longer valid in 50.6.10 #1373

@zorac

Description

@zorac

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

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions