@@ -270,18 +270,28 @@ export default iterateJsdoc(({
270
270
. concat ( ( ( ) => {
271
271
// Other methods are not in scope, but we need them, and we grab them here
272
272
if ( node ?. type === 'MethodDefinition' ) {
273
- return /** @type {import('estree').ClassBody } */ ( node . parent ) . body . map ( ( methodOrProp ) => {
273
+ return /** @type {import('estree').ClassBody } */ ( node . parent ) . body . flatMap ( ( methodOrProp ) => {
274
274
if ( methodOrProp . type === 'MethodDefinition' ) {
275
275
// eslint-disable-next-line unicorn/no-lonely-if -- Pattern
276
276
if ( methodOrProp . key . type === 'Identifier' ) {
277
- return methodOrProp . key . name ;
277
+ return [
278
+ methodOrProp . key . name ,
279
+ `${ /** @type {import('estree').ClassDeclaration } */ (
280
+ node . parent ?. parent
281
+ ) ?. id ?. name } .${ methodOrProp . key . name } `,
282
+ ] ;
278
283
}
279
284
}
280
285
281
286
if ( methodOrProp . type === 'PropertyDefinition' ) {
282
287
// eslint-disable-next-line unicorn/no-lonely-if -- Pattern
283
288
if ( methodOrProp . key . type === 'Identifier' ) {
284
- return methodOrProp . key . name ;
289
+ return [
290
+ methodOrProp . key . name ,
291
+ `${ /** @type {import('estree').ClassDeclaration } */ (
292
+ node . parent ?. parent
293
+ ) ?. id ?. name } .${ methodOrProp . key . name } `,
294
+ ] ;
285
295
}
286
296
}
287
297
/* c8 ignore next 2 -- Not yet built */
@@ -374,26 +384,49 @@ export default iterateJsdoc(({
374
384
parsedType,
375
385
tag,
376
386
} of tagsWithTypes ) {
377
- traverse ( parsedType , ( nde ) => {
387
+ traverse ( parsedType , ( nde , parentNode ) => {
388
+ /**
389
+ * @type {import('jsdoc-type-pratt-parser').NameResult & {
390
+ * _parent?: import('jsdoc-type-pratt-parser').NonRootResult
391
+ * }}
392
+ */
393
+ // eslint-disable-next-line canonical/id-match -- Avoid clashes
394
+ ( nde ) . _parent = parentNode ;
378
395
const {
379
396
type,
380
397
value,
381
398
} = /** @type {import('jsdoc-type-pratt-parser').NameResult } */ ( nde ) ;
382
399
400
+ let val = value ;
401
+
402
+ /** @type {import('jsdoc-type-pratt-parser').NonRootResult|undefined } */
403
+ let currNode = nde ;
404
+ do {
405
+ currNode =
406
+ /**
407
+ * @type {import('jsdoc-type-pratt-parser').NameResult & {
408
+ * _parent?: import('jsdoc-type-pratt-parser').NonRootResult
409
+ * }}
410
+ */ ( currNode ) . _parent ;
411
+ if ( currNode && 'right' in currNode && currNode . right ?. type === 'JsdocTypeProperty' ) {
412
+ val = val + '.' + currNode . right . value ;
413
+ }
414
+ } while ( currNode ?. type === 'JsdocTypeNamePath' ) ;
415
+
383
416
if ( type === 'JsdocTypeName' ) {
384
417
const structuredTypes = structuredTags [ tag . tag ] ?. type ;
385
- if ( ! allDefinedTypes . has ( value ) &&
386
- ( ! Array . isArray ( structuredTypes ) || ! structuredTypes . includes ( value ) )
418
+ if ( ! allDefinedTypes . has ( val ) &&
419
+ ( ! Array . isArray ( structuredTypes ) || ! structuredTypes . includes ( val ) )
387
420
) {
388
421
if ( ! disableReporting ) {
389
- report ( `The type '${ value } ' is undefined.` , null , tag ) ;
422
+ report ( `The type '${ val } ' is undefined.` , null , tag ) ;
390
423
}
391
- } else if ( markVariablesAsUsed && ! extraTypes . includes ( value ) ) {
424
+ } else if ( markVariablesAsUsed && ! extraTypes . includes ( val ) ) {
392
425
if ( sourceCode . markVariableAsUsed ) {
393
- sourceCode . markVariableAsUsed ( value ) ;
426
+ sourceCode . markVariableAsUsed ( val ) ;
394
427
/* c8 ignore next 3 */
395
428
} else {
396
- context . markVariableAsUsed ( value ) ;
429
+ context . markVariableAsUsed ( val ) ;
397
430
}
398
431
}
399
432
}
0 commit comments