@@ -174,11 +174,7 @@ const hasDefinedTypeReturnTag = (tag) => {
174
174
return true ;
175
175
} ;
176
176
177
- // Todo: These type and namepath tag listings currently look
178
- // at tags with `{...}` as being a type, but jsdoc may
179
- // allow some namepaths only within brackets as well
180
-
181
- const tagsWithMandatoryType = [
177
+ const tagsWithMandatoryTypePosition = [
182
178
// These both show curly brackets in the doc signature and examples
183
179
// "typeExpression"
184
180
'implements' ,
@@ -192,7 +188,7 @@ const tagsWithMandatoryType = [
192
188
// `param`/`arg`/`argument` (no signature)
193
189
// `property`/`prop` (no signature)
194
190
// `modifies` (undocumented)
195
- const tagsWithOptionalType = [
191
+ const tagsWithOptionalTypePosition = [
196
192
// These have the example showing curly brackets but not in their doc signature, e.g.: https://jsdoc.app/tags-enum.html
197
193
'enum' ,
198
194
'member' , 'var' ,
@@ -225,8 +221,8 @@ const tagsWithOptionalType = [
225
221
'modifies' ,
226
222
] ;
227
223
228
- const tagsWithOptionalTypeClosure = [
229
- ...tagsWithOptionalType ,
224
+ const tagsWithOptionalTypePositionClosure = [
225
+ ...tagsWithOptionalTypePosition ,
230
226
231
227
// Shows the signature with curly brackets but not in the example
232
228
// "typeExpression"
@@ -257,7 +253,8 @@ const namepathDefiningTags = [
257
253
'namespace' ,
258
254
259
255
// Todo: Should add `module` here (with optional "name" and no curly brackets);
260
- // this block impacts `no-undefined-types` and `valid-types` (search for "isNamepathDefiningTag|tagMightHaveNamepath|tagMightHaveEitherTypeOrNamepath")
256
+ // this block impacts `no-undefined-types` and `valid-types` (search for
257
+ // "isNamepathDefiningTag|tagMightHaveNamePosition|tagMightHaveEitherTypeOrNamePosition")
261
258
262
259
// These seem to all require a "namepath" in their signatures (with no counter-examples)
263
260
'name' ,
@@ -267,7 +264,7 @@ const namepathDefiningTags = [
267
264
268
265
// The following do not seem to allow curly brackets in their doc
269
266
// signature or examples (besides `modifies`)
270
- const tagsWithOptionalNamepath = [
267
+ const tagsWithOptionalNamePosition = [
271
268
...namepathDefiningTags ,
272
269
273
270
// `borrows` has a different format, however, so needs special parsing;
@@ -298,7 +295,7 @@ const tagsWithOptionalNamepath = [
298
295
// Todo: `@link` seems to require a namepath OR URL and might be checked as such.
299
296
300
297
// The doc signature of `event` seems to require a "name"
301
- const tagsWithMandatoryNamepath = [
298
+ const tagsWithMandatoryNamePosition = [
302
299
// "name" (and a special syntax for the `external` name)
303
300
'external' , 'host' ,
304
301
@@ -308,7 +305,7 @@ const tagsWithMandatoryNamepath = [
308
305
'typedef' ,
309
306
] ;
310
307
311
- const tagsWithMandatoryTypeOrNamepath = [
308
+ const tagsWithMandatoryTypeOrNamePosition = [
312
309
// "namepath"
313
310
'alias' ,
314
311
'augments' , 'extends' ,
@@ -330,30 +327,30 @@ const isNamepathDefiningTag = (tagName) => {
330
327
return namepathDefiningTags . includes ( tagName ) ;
331
328
} ;
332
329
333
- const tagMightHaveAType = ( mode , tag ) => {
334
- return tagsWithMandatoryType . includes ( tag ) || ( mode === 'closure' ?
335
- tagsWithOptionalTypeClosure . includes ( tag ) :
336
- tagsWithOptionalType . includes ( tag ) ) ;
330
+ const tagMightHaveTypePosition = ( mode , tag ) => {
331
+ return tagsWithMandatoryTypePosition . includes ( tag ) || ( mode === 'closure' ?
332
+ tagsWithOptionalTypePositionClosure . includes ( tag ) :
333
+ tagsWithOptionalTypePosition . includes ( tag ) ) ;
337
334
} ;
338
335
339
- const tagMustHaveType = ( tag ) => {
340
- return tagsWithMandatoryType . includes ( tag ) ;
336
+ const tagMustHaveTypePosition = ( tag ) => {
337
+ return tagsWithMandatoryTypePosition . includes ( tag ) ;
341
338
} ;
342
339
343
- const tagMightHaveNamepath = ( tag ) => {
344
- return tagsWithOptionalNamepath . includes ( tag ) ;
340
+ const tagMightHaveNamePosition = ( tag ) => {
341
+ return tagsWithOptionalNamePosition . includes ( tag ) ;
345
342
} ;
346
343
347
- const tagMustHaveNamepath = ( tag ) => {
348
- return tagsWithMandatoryNamepath . includes ( tag ) ;
344
+ const tagMustHaveNamePosition = ( tag ) => {
345
+ return tagsWithMandatoryNamePosition . includes ( tag ) ;
349
346
} ;
350
347
351
- const tagMightHaveEitherTypeOrNamepath = ( mode , tag ) => {
352
- return tagMightHaveAType ( mode , tag ) || tagMightHaveNamepath ( tag ) ;
348
+ const tagMightHaveEitherTypeOrNamePosition = ( mode , tag ) => {
349
+ return tagMightHaveTypePosition ( mode , tag ) || tagMightHaveNamePosition ( tag ) ;
353
350
} ;
354
351
355
- const tagMustHaveEitherTypeOrNamepath = ( tag ) => {
356
- return tagsWithMandatoryTypeOrNamepath . includes ( tag ) ;
352
+ const tagMustHaveEitherTypeOrNamePosition = ( tag ) => {
353
+ return tagsWithMandatoryTypeOrNamePosition . includes ( tag ) ;
357
354
} ;
358
355
359
356
/**
@@ -539,10 +536,10 @@ export default {
539
536
isNamepathDefiningTag,
540
537
isValidTag,
541
538
parseClosureTemplateTag,
542
- tagMightHaveAType ,
543
- tagMightHaveEitherTypeOrNamepath ,
544
- tagMightHaveNamepath ,
545
- tagMustHaveEitherTypeOrNamepath ,
546
- tagMustHaveNamepath ,
547
- tagMustHaveType ,
539
+ tagMightHaveEitherTypeOrNamePosition ,
540
+ tagMightHaveNamePosition ,
541
+ tagMightHaveTypePosition ,
542
+ tagMustHaveEitherTypeOrNamePosition ,
543
+ tagMustHaveNamePosition ,
544
+ tagMustHaveTypePosition ,
548
545
} ;
0 commit comments