diff --git a/docs/rules/valid-types.md b/docs/rules/valid-types.md index 2c436fe95..2f89e0d96 100644 --- a/docs/rules/valid-types.md +++ b/docs/rules/valid-types.md @@ -880,5 +880,9 @@ function quux() { function quux() { } + +/** + * @import { TestOne, TestTwo } from "./types" + */ ```` diff --git a/src/rules/validTypes.js b/src/rules/validTypes.js index 2930ed1d3..8c1839bf3 100644 --- a/src/rules/validTypes.js +++ b/src/rules/validTypes.js @@ -212,6 +212,12 @@ export default iterateJsdoc(({ continue; } + if (tag.tag === 'import') { + // A named import will look like a type, but not be valid; we also don't + // need to check the name/namepath + continue; + } + if (tag.tag === 'borrows') { const thisNamepath = /** @type {string} */ ( utils.getTagDescription(tag) diff --git a/test/rules/assertions/validTypes.js b/test/rules/assertions/validTypes.js index ec1cc494b..fb3710bb2 100644 --- a/test/rules/assertions/validTypes.js +++ b/test/rules/assertions/validTypes.js @@ -1853,5 +1853,12 @@ export default { } ` }, + { + code: ` + /** + * @import { TestOne, TestTwo } from "./types" + */ + `, + } ], };