File tree Expand file tree Collapse file tree 3 files changed +65
-0
lines changed Expand file tree Collapse file tree 3 files changed +65
-0
lines changed Original file line number Diff line number Diff line change @@ -943,5 +943,33 @@ export class Code {
943
943
/** @type {AGlobal.AnotherMethod} */
944
944
static #test5
945
945
}
946
+
947
+ import jsdoc from " eslint-plugin-jsdoc" ;
948
+
949
+ /**
950
+ * @import { Linter } from "eslint"
951
+ */
952
+
953
+ /**
954
+ * @type {Linter.Config}
955
+ */
956
+ export default [
957
+ {
958
+ plugins: { jsdoc },
959
+ rules: {
960
+ " jsdoc/no-undefined-types" : " error"
961
+ }
962
+ }
963
+ ];
964
+
965
+ /**
966
+ * @typedef {object} Abc
967
+ * @property {string} def Some string
968
+ */
969
+
970
+ /**
971
+ * @type {Abc['def']}
972
+ */
973
+ export const a = ' someString' ;
946
974
````
947
975
Original file line number Diff line number Diff line change @@ -440,6 +440,8 @@ export default iterateJsdoc(({
440
440
// Avoid appending for imports and globals since we don't want to
441
441
// check their properties which may or may not exist
442
442
! imports . includes ( val ) && ! globals . includes ( val ) &&
443
+ ! importTags . includes ( val ) &&
444
+ ! typedefDeclarations . includes ( val ) &&
443
445
currNode && 'right' in currNode &&
444
446
currNode . right ?. type === 'JsdocTypeProperty' ) {
445
447
val = val + '.' + currNode . right . value ;
Original file line number Diff line number Diff line change @@ -1657,5 +1657,40 @@ export default /** @type {import('../index.js').TestCases} */ ({
1657
1657
parser : typescriptEslintParser ,
1658
1658
} ,
1659
1659
} ,
1660
+ {
1661
+ code : `
1662
+ import jsdoc from "eslint-plugin-jsdoc";
1663
+
1664
+ /**
1665
+ * @import { Linter } from "eslint"
1666
+ */
1667
+
1668
+ /**
1669
+ * @type {Linter.Config}
1670
+ */
1671
+ export default [
1672
+ {
1673
+ plugins: { jsdoc },
1674
+ rules: {
1675
+ "jsdoc/no-undefined-types": "error"
1676
+ }
1677
+ }
1678
+ ];
1679
+ ` ,
1680
+ } ,
1681
+ {
1682
+ code : `
1683
+ /**
1684
+ * @typedef {object} Abc
1685
+ * @property {string} def Some string
1686
+ */
1687
+
1688
+ /**
1689
+ * @type {Abc['def']}
1690
+ */
1691
+ export const a = 'someString';
1692
+
1693
+ ` ,
1694
+ } ,
1660
1695
] ,
1661
1696
} ) ;
You can’t perform that action at this time.
0 commit comments