gajus / eslint-plugin-jsdoc

JSDoc specific linting rules for ESLint.
Other
1.09k stars 157 forks source link

`no-undefined-types` doesn't know the `@import` types #1244

Closed regseb closed 3 months ago

regseb commented 3 months ago

Expected behavior

no-undefined-types doesn't repport an error if the type used has been imported with @import tag.

Actual behavior

no-undefined-types doesn't know the @import types.

Files

package.json

{
  "name": "testcase",
  "version": "1.0.0",
  "dependencies": {
    "eslint": "9.5.0",
    "eslint-plugin-jsdoc": "48.2.13"
  }
}

eslint.config.mjs

import jsdoc from "eslint-plugin-jsdoc";

export default [
    {
        plugins: { jsdoc },
        rules: {
            "jsdoc/no-undefined-types": "error"
        }
    }
];

index.js

/**
 * @import { Linter } from "eslint"
 */

/**
 * @type {Linter.Config}
 */
const config = {};

To reproduce

  1. npm install
  2. npx eslint index.js

    /home/regseb/testcase/index.js
      6:1  error  The type 'Linter' is undefined  jsdoc/no-undefined-types
    
    ✖ 1 problem (1 error, 0 warnings)

Environment

brettz9 commented 3 months ago

In order to parse import statements for use by our rule, I've filed https://github.com/TomerAberbach/parse-imports/issues/10 as this package might help us do so.

github-actions[bot] commented 3 months ago

:tada: This issue has been resolved in version 48.2.14 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

brettz9 commented 3 months ago

And sorry had to revert due to #1246 (no CJS build in the dependency), so reopening. I've filed https://github.com/TomerAberbach/parse-imports/issues/12 in case the dependency can resolve this for us.

github-actions[bot] commented 3 months ago

:tada: This issue has been resolved in version 48.3.0 :tada:

The release is available on:

Your semantic-release bot :package::rocket: