eslint-plugin-jsdoc 64.3.8 → 64.3.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/rules/noUndefinedTypes.js +26 -24
package/package.json
CHANGED
|
@@ -483,32 +483,34 @@ export default iterateJsdoc(({
|
|
|
483
483
|
.concat(/** @type {string[]} */ (definedPreferredTypes))
|
|
484
484
|
.concat((() => {
|
|
485
485
|
// Other class members are not in scope, but we need them (e.g., for a
|
|
486
|
-
// sibling property or method referenced by `{@link}
|
|
487
|
-
//
|
|
486
|
+
// sibling property or method referenced by `{@link}`, or a member
|
|
487
|
+
// referenced by `{@link}` from the class's own JSDoc block), and we
|
|
488
|
+
// grab them here
|
|
489
|
+
/** @type {import('estree').ClassBody|undefined} */
|
|
490
|
+
let classBody;
|
|
491
|
+
/** @type {string|undefined} */
|
|
492
|
+
let className;
|
|
488
493
|
if (node?.type === 'MethodDefinition' || node?.type === 'PropertyDefinition') {
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
)?.id?.name}.${methodOrProp.key.name}`,
|
|
498
|
-
];
|
|
499
|
-
}
|
|
500
|
-
}
|
|
494
|
+
classBody = /** @type {import('estree').ClassBody} */ (node.parent);
|
|
495
|
+
className = /** @type {import('estree').ClassDeclaration} */ (
|
|
496
|
+
node.parent?.parent
|
|
497
|
+
)?.id?.name;
|
|
498
|
+
} else if (node?.type === 'ClassDeclaration' || node?.type === 'ClassExpression') {
|
|
499
|
+
classBody = node.body;
|
|
500
|
+
className = node.id?.name;
|
|
501
|
+
}
|
|
501
502
|
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
503
|
+
if (classBody) {
|
|
504
|
+
return classBody.body.flatMap((methodOrProp) => {
|
|
505
|
+
if (
|
|
506
|
+
(methodOrProp.type === 'MethodDefinition' ||
|
|
507
|
+
methodOrProp.type === 'PropertyDefinition') &&
|
|
508
|
+
methodOrProp.key.type === 'Identifier'
|
|
509
|
+
) {
|
|
510
|
+
return [
|
|
511
|
+
methodOrProp.key.name,
|
|
512
|
+
`${className}.${methodOrProp.key.name}`,
|
|
513
|
+
];
|
|
512
514
|
}
|
|
513
515
|
/* c8 ignore next 2 -- Not yet built */
|
|
514
516
|
|