File tree 3 files changed +121
-0
lines changed
3 files changed +121
-0
lines changed Original file line number Diff line number Diff line change @@ -22332,6 +22332,39 @@ function quux () {}
22332
22332
function quux () {}
22333
22333
// Settings: {"jsdoc":{"mode":"closure"}}
22334
22334
// Message: Syntax error in supresss type: blah
22335
+
22336
+ /**
22337
+ * @param {Object[]} employees
22338
+ * @param {string} employees[.name - The name of an employee.
22339
+ */
22340
+ function quux () {}
22341
+ // Message: Invalid name: unpaired brackets
22342
+
22343
+ /**
22344
+ * @param {Object[]} employees
22345
+ * @param {string} [] - The name of an employee.
22346
+ */
22347
+ function quux () {}
22348
+ // Message: Invalid name: empty name
22349
+
22350
+ /**
22351
+ * @param {Object[]} employees
22352
+ * @param {string} [] - The name of an employee.
22353
+ */
22354
+ function quux () {}
22355
+ // Message: Invalid name: empty name
22356
+
22357
+ /**
22358
+ * @param {string} [name=] - The name of an employee.
22359
+ */
22360
+ function quux () {}
22361
+ // Message: Invalid name: empty default value
22362
+
22363
+ /**
22364
+ * @param {string} [name==] - The name of an employee.
22365
+ */
22366
+ function quux () {}
22367
+ // Message: Invalid name: invalid default value syntax
22335
22368
````
22336
22369
22337
22370
The following patterns are not considered problems:
Original file line number Diff line number Diff line change @@ -158,6 +158,16 @@ export default iterateJsdoc(({
158
158
return true ;
159
159
} ;
160
160
161
+ if ( tag . problems . length ) {
162
+ const msg = tag . problems . reduce ( ( str , {
163
+ message,
164
+ } ) => {
165
+ return str + '; ' + message ;
166
+ } , '' ) . slice ( 2 ) ;
167
+ report ( `Invalid name: ${ msg } ` , null , tag ) ;
168
+ continue ;
169
+ }
170
+
161
171
if ( tag . tag === 'borrows' ) {
162
172
const thisNamepath = utils . getTagDescription ( tag ) . replace ( asExpression , '' )
163
173
. trim ( ) ;
Original file line number Diff line number Diff line change @@ -974,6 +974,84 @@ export default {
974
974
] ,
975
975
ignoreReadme : true ,
976
976
} ,
977
+ {
978
+ code : `
979
+ /**
980
+ * @param {Object[]} employees
981
+ * @param {string} employees[.name - The name of an employee.
982
+ */
983
+ function quux () {}
984
+
985
+ ` ,
986
+ errors : [
987
+ {
988
+ line : 4 ,
989
+ message : 'Invalid name: unpaired brackets' ,
990
+ } ,
991
+ ] ,
992
+ } ,
993
+ {
994
+ code : `
995
+ /**
996
+ * @param {Object[]} employees
997
+ * @param {string} [] - The name of an employee.
998
+ */
999
+ function quux () {}
1000
+
1001
+ ` ,
1002
+ errors : [
1003
+ {
1004
+ line : 4 ,
1005
+ message : 'Invalid name: empty name' ,
1006
+ } ,
1007
+ ] ,
1008
+ } ,
1009
+ {
1010
+ code : `
1011
+ /**
1012
+ * @param {Object[]} employees
1013
+ * @param {string} [] - The name of an employee.
1014
+ */
1015
+ function quux () {}
1016
+
1017
+ ` ,
1018
+ errors : [
1019
+ {
1020
+ line : 4 ,
1021
+ message : 'Invalid name: empty name' ,
1022
+ } ,
1023
+ ] ,
1024
+ } ,
1025
+ {
1026
+ code : `
1027
+ /**
1028
+ * @param {string} [name=] - The name of an employee.
1029
+ */
1030
+ function quux () {}
1031
+
1032
+ ` ,
1033
+ errors : [
1034
+ {
1035
+ line : 3 ,
1036
+ message : 'Invalid name: empty default value' ,
1037
+ } ,
1038
+ ] ,
1039
+ } ,
1040
+ {
1041
+ code : `
1042
+ /**
1043
+ * @param {string} [name==] - The name of an employee.
1044
+ */
1045
+ function quux () {}
1046
+
1047
+ ` ,
1048
+ errors : [
1049
+ {
1050
+ line : 3 ,
1051
+ message : 'Invalid name: invalid default value syntax' ,
1052
+ } ,
1053
+ ] ,
1054
+ } ,
977
1055
] ,
978
1056
valid : [
979
1057
{
You can’t perform that action at this time.
0 commit comments