Skip to content

no-unused-vars wrong error when using imported JSDoc definition as @property type. #507

Closed
@ernestostifano

Description

@ernestostifano

eslint-plugin-jsdoc/no-undefined-types is correctly added to ESLint configuration.

import {myTypesA} from '../internal/file.js'; // ERROR
import {myTypesB} from '../internal/file.js'; // NO ERROR

/**
* @typedef newType
* @property {myTypesA.someType} someProp - Some prop.
*/

/**
* @param {newType} arg - Arg.
*/
function myFunctionA(arg) {
    return arg;
}

/**
* @param {myTypesB.someType} arg - Arg.
*/
function myFunctionB(arg) {
    return arg;
}

What did you expect to happen?

There should not be an error.
JSDoc definition is correctly imported and used even when the error is present.
The error only appears when imported type is used as a type for a @property tag.
Error does not appear is used in @param tag.

What actually happened? Please include the actual, raw output from ESLint.

/path/to/issue/file.js
  1:9  error  'fiberRegExpTypes' is defined but never used  no-unused-vars

Please see this ESLint issue for more details.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions