File tree 4 files changed +105
-1
lines changed 4 files changed +105
-1
lines changed Original file line number Diff line number Diff line change @@ -487,6 +487,21 @@ function quux (items) {
487
487
}
488
488
// Settings: {"jsdoc":{"mode":"typescript"}}
489
489
// Message: Syntax error in type: JsdocTypeNullable
490
+
491
+ /**
492
+ * An inline {@link } tag without content.
493
+ */
494
+ // Message: Inline tag "link" missing content
495
+
496
+ /**
497
+ * An inline {@tutorial } tag without content.
498
+ */
499
+ // Message: Inline tag "tutorial" missing content
500
+
501
+ /**
502
+ * @param {SomeType} aName An inline {@link } tag without content.
503
+ */
504
+ // Message: Inline tag "link" missing content
490
505
````
491
506
492
507
@@ -850,5 +865,17 @@ function quux() {
850
865
/**
851
866
* @returns {Promise<{publicKey, privateKey}>} - The public and private key
852
867
*/
868
+
869
+ /**
870
+ * Some other {@inline} tag.
871
+ */
872
+
873
+ /**
874
+ * @param {SomeType} aName An inline {@link text } tag with content.
875
+ */
876
+
877
+ /**
878
+ * An inline {@link text } tag with content.
879
+ */
853
880
````
854
881
Original file line number Diff line number Diff line change @@ -483,7 +483,7 @@ const hasParams = (functionNode) => {
483
483
484
484
/**
485
485
* Gets all names of the target type, including those that refer to a path, e.g.
486
- * "@param foo; @param foo.bar" .
486
+ * ` foo` or ` foo.bar` .
487
487
* @param {import('comment-parser').Block } jsdoc
488
488
* @param {string } targetTagName
489
489
* @returns {{
Original file line number Diff line number Diff line change @@ -5,6 +5,11 @@ import {
5
5
tryParse ,
6
6
} from '@es-joy/jsdoccomment' ;
7
7
8
+ const inlineTags = new Set ( [
9
+ 'link' , 'linkcode' , 'linkplain' ,
10
+ 'tutorial' ,
11
+ ] ) ;
12
+
8
13
const asExpression = / a s \s + / u;
9
14
10
15
const suppressTypes = new Set ( [
@@ -327,6 +332,18 @@ export default iterateJsdoc(({
327
332
validNamepathParsing ( tag . name , tag . tag ) ;
328
333
}
329
334
}
335
+
336
+ for ( const inlineTag of tag . inlineTags ) {
337
+ if ( inlineTags . has ( inlineTag . tag ) && ! inlineTag . text && ! inlineTag . namepathOrURL ) {
338
+ report ( `Inline tag "${ inlineTag . tag } " missing content` , null , tag ) ;
339
+ }
340
+ }
341
+ }
342
+
343
+ for ( const inlineTag of jsdoc . inlineTags ) {
344
+ if ( inlineTags . has ( inlineTag . tag ) && ! inlineTag . text && ! inlineTag . namepathOrURL ) {
345
+ report ( `Inline tag "${ inlineTag . tag } " missing content` ) ;
346
+ }
330
347
}
331
348
} , {
332
349
iterateAllJsdocs : true ,
Original file line number Diff line number Diff line change @@ -1102,6 +1102,45 @@ export default {
1102
1102
} ,
1103
1103
} ,
1104
1104
} ,
1105
+ {
1106
+ code : `
1107
+ /**
1108
+ * An inline {@link} tag without content.
1109
+ */
1110
+ ` ,
1111
+ errors : [
1112
+ {
1113
+ line : 2 ,
1114
+ message : 'Inline tag "link" missing content' ,
1115
+ } ,
1116
+ ] ,
1117
+ } ,
1118
+ {
1119
+ code : `
1120
+ /**
1121
+ * An inline {@tutorial} tag without content.
1122
+ */
1123
+ ` ,
1124
+ errors : [
1125
+ {
1126
+ line : 2 ,
1127
+ message : 'Inline tag "tutorial" missing content' ,
1128
+ } ,
1129
+ ] ,
1130
+ } ,
1131
+ {
1132
+ code : `
1133
+ /**
1134
+ * @param {SomeType} aName An inline {@link} tag without content.
1135
+ */
1136
+ ` ,
1137
+ errors : [
1138
+ {
1139
+ line : 3 ,
1140
+ message : 'Inline tag "link" missing content' ,
1141
+ } ,
1142
+ ] ,
1143
+ } ,
1105
1144
] ,
1106
1145
valid : [
1107
1146
{
@@ -1790,5 +1829,26 @@ export default {
1790
1829
*/
1791
1830
` ,
1792
1831
} ,
1832
+ {
1833
+ code : `
1834
+ /**
1835
+ * Some other {@inline} tag.
1836
+ */
1837
+ ` ,
1838
+ } ,
1839
+ {
1840
+ code : `
1841
+ /**
1842
+ * @param {SomeType} aName An inline {@link text} tag with content.
1843
+ */
1844
+ ` ,
1845
+ } ,
1846
+ {
1847
+ code : `
1848
+ /**
1849
+ * An inline {@link text} tag with content.
1850
+ */
1851
+ ` ,
1852
+ } ,
1793
1853
] ,
1794
1854
} ;
You can’t perform that action at this time.
0 commit comments