Skip to content

Commit

Permalink
fix(valid-types): disable checking of types/names within import t…
Browse files Browse the repository at this point in the history
…ags; fixes #1226
  • Loading branch information
brettz9 committed May 9, 2024
1 parent e343ab5 commit 4da4aeb
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
4 changes: 4 additions & 0 deletions docs/rules/valid-types.md
Original file line number Diff line number Diff line change
Expand Up @@ -880,5 +880,9 @@ function quux() {
function quux() {

}

/**
* @import { TestOne, TestTwo } from "./types"
*/
````

6 changes: 6 additions & 0 deletions src/rules/validTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
7 changes: 7 additions & 0 deletions test/rules/assertions/validTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -1853,5 +1853,12 @@ export default {
}
`
},
{
code: `
/**
* @import { TestOne, TestTwo } from "./types"
*/
`,
}
],
};

0 comments on commit 4da4aeb

Please sign in to comment.